diff --git a/DataSpec/AssetMap32Download.cmake b/DataSpec/AssetMap32Download.cmake index fe984c54c..d9a017057 100644 --- a/DataSpec/AssetMap32Download.cmake +++ b/DataSpec/AssetMap32Download.cmake @@ -1,3 +1,3 @@ message(STATUS "32-bit asset name map not found; downloading to '${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin'") file(DOWNLOAD "https://axiodl.com/files/AssetNameMap32.dat" - ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=90b4e941c192eef41c81e60314f348bc787d1336) + ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=90b4e941c192eef41c81e60314f348bc787d1336) diff --git a/DataSpec/AssetNameMap.cpp b/DataSpec/AssetNameMap.cpp index 803a38faa..4d4685b99 100644 --- a/DataSpec/AssetNameMap.cpp +++ b/DataSpec/AssetNameMap.cpp @@ -34,8 +34,9 @@ void LoadAssetMap(athena::io::MemoryReader& ar) { if (ar.length() >= 4) ar.readBytesToBuf(&magic, 4); if (magic != FOURCC('AIDM')) - Log.report(logvisor::Warning, - FMT_STRING(_SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files."))); + Log.report( + logvisor::Warning, + FMT_STRING(_SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files."))); else { uint32_t assetCount = ar.readUint32Big(); g_AssetNameMap.reserve(assetCount); @@ -64,8 +65,9 @@ void InitAssetNameMap() { LoadAssetMap(ar); delete[](decompressed); } else { - Log.report(logvisor::Warning, - FMT_STRING(_SYS_STR("AssetNameMap32 unavailable; Assets will not have proper filenames for most files."))); + Log.report( + logvisor::Warning, + FMT_STRING(_SYS_STR("AssetNameMap32 unavailable; Assets will not have proper filenames for most files."))); } /* Now load the 64bit map for MP3 */ if (ASSET_NAME_MP64_DECOMPRESSED_SZ != 0u) { @@ -76,8 +78,9 @@ void InitAssetNameMap() { LoadAssetMap(ar); delete[](decompressed); } else { - Log.report(logvisor::Warning, - FMT_STRING(_SYS_STR("AssetNameMap64 unavailable; Assets will not have proper filenames for most files."))); + Log.report( + logvisor::Warning, + FMT_STRING(_SYS_STR("AssetNameMap64 unavailable; Assets will not have proper filenames for most files."))); } g_AssetNameMapInit = true; } diff --git a/DataSpec/Blender/RetroMasterShader.py b/DataSpec/Blender/RetroMasterShader.py index 4749aa409..fe97fd640 100644 --- a/DataSpec/Blender/RetroMasterShader.py +++ b/DataSpec/Blender/RetroMasterShader.py @@ -2,6 +2,7 @@ import bpy + # Root Eevee Nodes # Additive output node @@ -32,6 +33,7 @@ def make_additive_output(): new_grp.links.new(transparent_bdsf.outputs[0], emissive_add_shader.inputs[0]) new_grp.links.new(emissive_add_shader.outputs[0], mat_out.inputs['Surface']) + # Blend output node def make_blend_opaque_output(): for tp in ('HECLBlendOutput', 'HECLOpaqueOutput'): @@ -50,7 +52,8 @@ def make_blend_opaque_output(): # Links new_grp.links.new(grp_in.outputs['Surface'], mat_out.inputs['Surface']) -#0 - RetroShader + +# 0 - RetroShader def make_retro_shader(): new_grp = bpy.data.node_groups.new('RetroShader', 'ShaderNodeTree') surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface') @@ -216,6 +219,7 @@ def make_retro_shader(): new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2]) new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface']) + def make_retro_dynamic_shader(): new_grp = bpy.data.node_groups.new('RetroDynamicShader', 'ShaderNodeTree') surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface') @@ -386,6 +390,7 @@ def make_retro_dynamic_shader(): new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2]) new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface']) + def make_retro_dynamic_alpha_shader(): new_grp = bpy.data.node_groups.new('RetroDynamicAlphaShader', 'ShaderNodeTree') surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface') @@ -567,6 +572,7 @@ def make_retro_dynamic_alpha_shader(): new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2]) new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface']) + def make_retro_dynamic_character_shader(): new_grp = bpy.data.node_groups.new('RetroDynamicCharacterShader', 'ShaderNodeTree') surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface') @@ -721,6 +727,7 @@ def make_retro_dynamic_character_shader(): new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2]) new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface']) + # MP3 / DKCR Material Passes: # https://wiki.axiodl.com/w/Materials_(Metroid_Prime_3) @@ -1000,6 +1007,7 @@ def make_retro_shader_mp3_color(): new_grp.links.new(nodes["Mix Shader"].outputs[0], nodes["Add Shader.011"].inputs[0]) new_grp.links.new(nodes["Group Input"].outputs[12], nodes["Transparent BSDF"].inputs[0]) + def make_retro_shader_mp3_bloom(): new_grp = bpy.data.node_groups.new("__RetroShaderMP3Bloom", "ShaderNodeTree") new_grp.use_fake_user = True @@ -1191,6 +1199,7 @@ def make_retro_shader_mp3_bloom(): new_grp.links.new(nodes["Add Shader.001"].outputs[0], nodes["Add Shader"].inputs[1]) new_grp.links.new(nodes["Group Input"].outputs[11], nodes["Transparent BSDF.001"].inputs[0]) + def make_retro_shader_mp3(): new_grp = bpy.data.node_groups.new("RetroShaderMP3", "ShaderNodeTree") new_grp.use_fake_user = True @@ -1368,6 +1377,7 @@ def make_retro_shader_mp3(): new_grp.links.new(nodes["Group Input"].outputs[18], nodes["Group.001"].inputs[12]) new_grp.links.new(nodes["Group Input"].outputs[18], nodes["Group"].inputs[11]) + ROOT_SHADER_GROUPS = ( make_retro_shader, make_retro_dynamic_shader, @@ -1378,6 +1388,7 @@ ROOT_SHADER_GROUPS = ( make_retro_shader_mp3 ) + # UV animation nodes: # https://wiki.axiodl.com/w/Materials_(Metroid_Prime)#UV_Animations @@ -1415,6 +1426,7 @@ def make_uva0(): new_grp.links.new(vec_xf.outputs[0], uv_scale.inputs[0]) new_grp.links.new(uv_scale.outputs[0], grp_out.inputs[0]) + # 1 - Modelview Inverse def make_uva1(): new_grp = bpy.data.node_groups.new('RetroUVMode1NodeN', 'ShaderNodeTree') @@ -1433,6 +1445,7 @@ def make_uva1(): # Links new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0]) + # 2 - UV Scroll def make_uva2(): new_grp = bpy.data.node_groups.new('RetroUVMode2Node', 'ShaderNodeTree') @@ -1474,6 +1487,7 @@ def make_uva2(): new_grp.links.new(adder1.outputs[0], adder2.inputs[1]) new_grp.links.new(adder2.outputs[0], grp_out.inputs[0]) + # 3 - Rotation def make_uva3(): new_grp = bpy.data.node_groups.new('RetroUVMode3Node', 'ShaderNodeTree') @@ -1509,6 +1523,7 @@ def make_uva3(): new_grp.links.new(grp_in.outputs[2], mult.inputs[0]) new_grp.links.new(mult.outputs[0], add1.inputs[1]) + # 4 - Horizontal Filmstrip Animation def make_uva4(): new_grp = bpy.data.node_groups.new('RetroUVMode4Node', 'ShaderNodeTree') @@ -1594,6 +1609,7 @@ def make_uva4(): new_grp.links.new(map1.outputs[0], add1.inputs[0]) new_grp.links.new(add1.outputs[0], grp_out.inputs[0]) + # 5 - Vertical Filmstrip Animation def make_uva5(): new_grp = bpy.data.node_groups.new('RetroUVMode5Node', 'ShaderNodeTree') @@ -1679,6 +1695,7 @@ def make_uva5(): new_grp.links.new(map1.outputs[0], add1.inputs[0]) new_grp.links.new(add1.outputs[0], grp_out.inputs[0]) + # 6 - Model Matrix def make_uva6(): new_grp = bpy.data.node_groups.new('RetroUVMode6NodeN', 'ShaderNodeTree') @@ -1708,6 +1725,7 @@ def make_uva6(): new_grp.links.new(geom_in.outputs['Object'], adder1.inputs[1]) new_grp.links.new(adder1.outputs[0], grp_out.inputs[0]) + # 7 - Mode Who Must Not Be Named def make_uva7(): new_grp = bpy.data.node_groups.new('RetroUVMode7NodeN', 'ShaderNodeTree') @@ -1807,6 +1825,7 @@ def make_uva7(): new_grp.links.new(mult5.outputs[0], add2.inputs[1]) new_grp.links.new(add2.outputs[0], grp_out.inputs[0]) + # 8 - Mode 8 def make_uva8(): new_grp = bpy.data.node_groups.new('RetroUVMode8Node', 'ShaderNodeTree') @@ -1834,6 +1853,7 @@ def make_uva8(): # Links new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0]) + UV_ANIMATION_GROUPS = ( make_uva0, make_uva1, @@ -1846,6 +1866,7 @@ UV_ANIMATION_GROUPS = ( make_uva8 ) + def make_master_shader_library(): make_additive_output() make_blend_opaque_output() @@ -1853,4 +1874,3 @@ def make_master_shader_library(): shad() for uva in UV_ANIMATION_GROUPS: uva() - diff --git a/DataSpec/CMakeLists.txt b/DataSpec/CMakeLists.txt index 5b20012db..ca7a85d63 100644 --- a/DataSpec/CMakeLists.txt +++ b/DataSpec/CMakeLists.txt @@ -1,31 +1,31 @@ # Assembles a source/header pair list for use in a DNA library macro(make_dnalist) - file(RELATIVE_PATH subdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}") - set(CMAKE_CURRENT_LIST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}") - file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}") - foreach(type ${ARGN}) - get_filename_component(dir ${type} DIRECTORY) - if(dir) - file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}/${dir}") - set(dir "${dir}/") - endif() - get_filename_component(name ${type} NAME) - list(APPEND DNA_SOURCES "${subdir}/${dir}atdna_${name}.cpp") - list(APPEND DNA_HEADERS "${subdir}/${dir}${name}.hpp") - endforeach() + file(RELATIVE_PATH subdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}") + set(CMAKE_CURRENT_LIST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}") + foreach (type ${ARGN}) + get_filename_component(dir ${type} DIRECTORY) + if (dir) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}/${dir}") + set(dir "${dir}/") + endif () + get_filename_component(name ${type} NAME) + list(APPEND DNA_SOURCES "${subdir}/${dir}atdna_${name}.cpp") + list(APPEND DNA_HEADERS "${subdir}/${dir}${name}.hpp") + endforeach () endmacro() # Assembles source files together for the main DataSpecCommon library macro(dataspec_add_list rel_path a_list) - unset(tmp_list) - foreach(path IN LISTS ${a_list}) - if (IS_ABSOLUTE ${path}) - list(APPEND tmp_list "${path}") - else() - list(APPEND tmp_list "${rel_path}/${path}") - endif() - endforeach(path) - set(${a_list} "${tmp_list}") + unset(tmp_list) + foreach (path IN LISTS ${a_list}) + if (IS_ABSOLUTE ${path}) + list(APPEND tmp_list "${path}") + else () + list(APPEND tmp_list "${rel_path}/${path}") + endif () + endforeach (path) + set(${a_list} "${tmp_list}") endmacro(dataspec_add_list) # Each game's DNA library @@ -41,31 +41,31 @@ bintoc(RetroMasterShader.cpp Blender/RetroMasterShader.py RETRO_MASTER_SHADER) # Download asset name databases add_custom_command(OUTPUT AssetNameMap32.bin COMMAND ${CMAKE_COMMAND} ARGS -P - ${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake) + ${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake) bintoc_compress(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32) add_custom_command(OUTPUT AssetNameMap64.bin COMMAND ${CMAKE_COMMAND} ARGS -P - ${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake) + ${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake) bintoc_compress(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64) # Each game's DataSpec implementation add_library(RetroDataSpec - SpecBase.cpp - ${DNACOMMON_SOURCES} - SpecMP1.cpp - ${DNAMP1_SOURCES} - ${ScriptObjectsMP1_SOURCES} - ${DNAMP1_SFX_SOURCES} - SpecMP2.cpp - ${DNAMP2_SOURCES} - SpecMP3.cpp - ${DNAMP3_SOURCES} - Blender/BlenderSupport.hpp - Blender/BlenderSupport.cpp - Blender/RetroMasterShader.py - AssetNameMap.hpp - AssetNameMap.cpp - RetroMasterShader.cpp) + SpecBase.cpp + ${DNACOMMON_SOURCES} + SpecMP1.cpp + ${DNAMP1_SOURCES} + ${ScriptObjectsMP1_SOURCES} + ${DNAMP1_SFX_SOURCES} + SpecMP2.cpp + ${DNAMP2_SOURCES} + SpecMP3.cpp + ${DNAMP3_SOURCES} + Blender/BlenderSupport.hpp + Blender/BlenderSupport.cpp + Blender/RetroMasterShader.py + AssetNameMap.hpp + AssetNameMap.cpp + RetroMasterShader.cpp) add_library(AssetNameMap AssetNameMap32.bin AssetNameMap32.cpp AssetNameMap64.bin AssetNameMap64.cpp) @@ -74,19 +74,19 @@ add_library(AssetNameMapNull get_target_property(HECL_INCLUDES hecl-full INCLUDE_DIRECTORIES) target_include_directories(RetroDataSpec PUBLIC ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} - ${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}) + ${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}) target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod squish ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} lzokay logvisor) -if(COMMAND add_sanitizers) - add_sanitizers(RetroDataSpec) -endif() +if (COMMAND add_sanitizers) + add_sanitizers(RetroDataSpec) +endif () # Resolve all DNA sources into target list(LENGTH DNA_SOURCES count) math(EXPR count "${count}-1") -foreach(i RANGE ${count}) - list(GET DNA_SOURCES ${i} src) - list(GET DNA_HEADERS ${i} header) - target_atdna(RetroDataSpec ${src} ${header}) -endforeach() +foreach (i RANGE ${count}) + list(GET DNA_SOURCES ${i} src) + list(GET DNA_HEADERS ${i} header) + target_atdna(RetroDataSpec ${src} ${header}) +endforeach () add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$") diff --git a/DataSpec/DNACommon/ANCS.cpp b/DataSpec/DNACommon/ANCS.cpp index 03f89f3a9..24e469501 100644 --- a/DataSpec/DNACommon/ANCS.cpp +++ b/DataSpec/DNACommon/ANCS.cpp @@ -118,27 +118,25 @@ bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const he { hecl::blender::PyOutStream os = conn.beginPythonOut(true); - os.format(FMT_STRING( - "import bpy\n" - "from mathutils import Vector\n" - "bpy.context.scene.name = '{}'\n" - "bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n" - "\n" - "# Clear Scene\n" - "if len(bpy.data.collections):\n" - " bpy.data.collections.remove(bpy.data.collections[0])\n" - "\n" - "actor_data = bpy.context.scene.hecl_sact_data\n" - "arm_obj = None\n"), - pakRouter.getBestEntryName(entry)); + os.format(FMT_STRING("import bpy\n" + "from mathutils import Vector\n" + "bpy.context.scene.name = '{}'\n" + "bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n" + "\n" + "# Clear Scene\n" + "if len(bpy.data.collections):\n" + " bpy.data.collections.remove(bpy.data.collections[0])\n" + "\n" + "actor_data = bpy.context.scene.hecl_sact_data\n" + "arm_obj = None\n"), + pakRouter.getBestEntryName(entry)); std::unordered_set cinfsDone; for (const auto& info : chResInfo) { /* Provide data to add-on */ - os.format(FMT_STRING( - "actor_subtype = actor_data.subtypes.add()\n" - "actor_subtype.name = '{}'\n\n"), - info.name); + os.format(FMT_STRING("actor_subtype = actor_data.subtypes.add()\n" + "actor_subtype.name = '{}'\n\n"), + info.name); /* Build CINF if needed */ if (cinfsDone.find(info.cinf) == cinfsDone.end()) { @@ -177,7 +175,7 @@ bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const he /* Link CMDL */ if (const typename PAKRouter::EntryType* cmdlE = - pakRouter.lookupEntry(overlay.second.first, nullptr, true, false)) { + pakRouter.lookupEntry(overlay.second.first, nullptr, true, false)) { hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE); os.linkMesh(cmdlPath.getAbsolutePathUTF8(), pakRouter.getBestEntryName(*cmdlE)); @@ -249,18 +247,16 @@ bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const he for (const auto& id : animResInfo) { typename ANCSDNA::ANIMType anim; if (pakRouter.lookupAndReadDNA(id.second.animId, anim, true)) { - os.format(FMT_STRING( - "act = bpy.data.actions.new('{}')\n" - "act.use_fake_user = True\n" - "act.anim_id = '{}'\n"), - id.second.name, id.second.animId); + os.format(FMT_STRING("act = bpy.data.actions.new('{}')\n" + "act.use_fake_user = True\n" + "act.anim_id = '{}'\n"), + id.second.name, id.second.animId); anim.sendANIMToBlender(os, inverter, id.second.additive); } - os.format(FMT_STRING( - "actor_action = actor_data.actions.add()\n" - "actor_action.name = '{}'\n"), - id.second.name); + os.format(FMT_STRING("actor_action = actor_data.actions.add()\n" + "actor_action.name = '{}'\n"), + id.second.name); /* Extract EVNT if present */ anim.extractEVNT(id.second, outPath, pakRouter, force); diff --git a/DataSpec/DNACommon/AROTBuilder.hpp b/DataSpec/DNACommon/AROTBuilder.hpp index a10a00128..d578c0567 100644 --- a/DataSpec/DNACommon/AROTBuilder.hpp +++ b/DataSpec/DNACommon/AROTBuilder.hpp @@ -12,7 +12,6 @@ template struct PATH; } - struct AROTBuilder { using ColMesh = hecl::blender::ColMesh; diff --git a/DataSpec/DNACommon/BabeDead.cpp b/DataSpec/DNACommon/BabeDead.cpp index 51a43ea19..ff9b01526 100644 --- a/DataSpec/DNACommon/BabeDead.cpp +++ b/DataSpec/DNACommon/BabeDead.cpp @@ -18,72 +18,67 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi switch (light.lightType) { case BabeDeadLight::LightType::LocalAmbient: case BabeDeadLight::LightType::LocalAmbient2: - os.format(FMT_STRING( - "bg_node.inputs[0].default_value = ({},{},{},1.0)\n" - "bg_node.inputs[1].default_value = {}\n"), - light.color.simd[0], light.color.simd[1], light.color.simd[2], light.q / 8.f); + os.format(FMT_STRING("bg_node.inputs[0].default_value = ({},{},{},1.0)\n" + "bg_node.inputs[1].default_value = {}\n"), + light.color.simd[0], light.color.simd[1], light.color.simd[2], light.q / 8.f); return; case BabeDeadLight::LightType::Directional: - os.format(FMT_STRING( - "lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SUN')\n" - "lamp.color = ({},{},{})\n" - "lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n" - "lamp_obj.rotation_mode = 'QUATERNION'\n" - "lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector(({},{},{})))\n" - "lamp.use_shadow = {}\n" - "\n"), - s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], light.direction.simd[0], - light.direction.simd[1], light.direction.simd[2], light.castShadows ? "True" : "False"); + os.format(FMT_STRING("lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SUN')\n" + "lamp.color = ({},{},{})\n" + "lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n" + "lamp_obj.rotation_mode = 'QUATERNION'\n" + "lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector(({},{},{})))\n" + "lamp.use_shadow = {}\n" + "\n"), + s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], light.direction.simd[0], + light.direction.simd[1], light.direction.simd[2], light.castShadows ? "True" : "False"); return; case BabeDeadLight::LightType::Custom: - os.format(FMT_STRING( - "lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'POINT')\n" - "lamp.color = ({},{},{})\n" - "lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n" - "lamp.shadow_soft_size = 1.0\n" - "lamp.use_shadow = {}\n" - "\n"), - s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], - light.castShadows ? "True" : "False"); + os.format(FMT_STRING("lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'POINT')\n" + "lamp.color = ({},{},{})\n" + "lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n" + "lamp.shadow_soft_size = 1.0\n" + "lamp.use_shadow = {}\n" + "\n"), + s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], + light.castShadows ? "True" : "False"); break; case BabeDeadLight::LightType::Spot: case BabeDeadLight::LightType::Spot2: - os.format(FMT_STRING( - "lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SPOT')\n" - "lamp.color = ({},{},{})\n" - "lamp.spot_size = {:.6g}\n" - "lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n" - "lamp_obj.rotation_mode = 'QUATERNION'\n" - "lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector(({},{},{})))\n" - "lamp.shadow_soft_size = 0.5\n" - "lamp.use_shadow = {}\n" - "\n"), - s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], zeus::degToRad(light.spotCutoff), - light.direction.simd[0], light.direction.simd[1], light.direction.simd[2], - light.castShadows ? "True" : "False"); + os.format(FMT_STRING("lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SPOT')\n" + "lamp.color = ({},{},{})\n" + "lamp.spot_size = {:.6g}\n" + "lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n" + "lamp_obj.rotation_mode = 'QUATERNION'\n" + "lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector(({},{},{})))\n" + "lamp.shadow_soft_size = 0.5\n" + "lamp.use_shadow = {}\n" + "\n"), + s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], zeus::degToRad(light.spotCutoff), + light.direction.simd[0], light.direction.simd[1], light.direction.simd[2], + light.castShadows ? "True" : "False"); break; default: return; } - os.format(FMT_STRING( - "lamp.retro_layer = {}\n" - "lamp.retro_origtype = {}\n" - "lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n" - "lamp.constant_coefficient = 0\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 = {}\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 = ({},{},{},1.0)\n" - "lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n" - "lamp_obj.location = ({},{},{})\n" - "bpy.context.scene.collection.objects.link(lamp_obj)\n" - "\n"), - s, unsigned(light.lightType), light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2], - light.position.simd[0], light.position.simd[1], light.position.simd[2]); + os.format(FMT_STRING("lamp.retro_layer = {}\n" + "lamp.retro_origtype = {}\n" + "lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n" + "lamp.constant_coefficient = 0\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 = {}\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 = ({},{},{},1.0)\n" + "lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n" + "lamp_obj.location = ({},{},{})\n" + "bpy.context.scene.collection.objects.link(lamp_obj)\n" + "\n"), + s, unsigned(light.lightType), light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2], + light.position.simd[0], light.position.simd[1], light.position.simd[2]); switch (light.falloff) { case BabeDeadLight::Falloff::Constant: diff --git a/DataSpec/DNACommon/BabeDead.hpp b/DataSpec/DNACommon/BabeDead.hpp index 348ea4fe9..3c6781c72 100644 --- a/DataSpec/DNACommon/BabeDead.hpp +++ b/DataSpec/DNACommon/BabeDead.hpp @@ -3,7 +3,7 @@ namespace hecl::blender { struct Light; class PyOutStream; -} +} // namespace hecl::blender namespace DataSpec { diff --git a/DataSpec/DNACommon/CMDL.cpp b/DataSpec/DNACommon/CMDL.cpp index 7b55493ee..0134ea70a 100644 --- a/DataSpec/DNACommon/CMDL.cpp +++ b/DataSpec/DNACommon/CMDL.cpp @@ -84,15 +84,14 @@ void ReadMaterialSetToBlender_1_2(hecl::blender::PyOutStream& os, const Material } hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex); hecl::SystemUTF8Conv resPathView(resPath); - os.format(FMT_STRING( - "if '{}' in bpy.data.images:\n" - " image = bpy.data.images['{}']\n" - "else:\n" - " image = bpy.data.images.load('''//{}''')\n" - " image.name = '{}'\n" - "texmap_list.append(image)\n" - "\n"), - texName, texName, resPathView, texName); + os.format(FMT_STRING("if '{}' in bpy.data.images:\n" + " image = bpy.data.images['{}']\n" + "else:\n" + " image = bpy.data.images.load('''//{}''')\n" + " image.name = '{}'\n" + "texmap_list.append(image)\n" + "\n"), + texName, texName, resPathView, texName); } unsigned m = 0; @@ -148,11 +147,10 @@ public: for (const auto& [ev, evVec] : m_extraVerts) { for (const std::pair& se : evVec) { if (se.second == nextVert) { - os.format(FMT_STRING( - "bm.verts.ensure_lookup_table()\n" - "orig_vert = bm.verts[{}]\n" - "vert = bm.verts.new(orig_vert.co)\n"), - ev + baseVert); + os.format(FMT_STRING("bm.verts.ensure_lookup_table()\n" + "orig_vert = bm.verts[{}]\n" + "vert = bm.verts.new(orig_vert.co)\n"), + ev + baseVert); rp.first.second->weightVertex(os, *rp.second.second, se.first); ++nextVert; ++addedVerts; @@ -466,12 +464,11 @@ void InitGeomBlenderContext(hecl::blender::PyOutStream& os, const hecl::ProjectP "\n"; /* Link master shader library */ - os.format(FMT_STRING( - "# Master shader library\n" - "with bpy.data.libraries.load('{}', link=True, relative=True) as (data_from, data_to):\n" - " data_to.node_groups = data_from.node_groups\n" - "\n"), - masterShaderPath.getAbsolutePathUTF8()); + os.format(FMT_STRING("# Master shader library\n" + "with bpy.data.libraries.load('{}', link=True, relative=True) as (data_from, data_to):\n" + " data_to.node_groups = data_from.node_groups\n" + "\n"), + masterShaderPath.getAbsolutePathUTF8()); } void FinishBlenderMesh(hecl::blender::PyOutStream& os, unsigned matSetCount, int meshIdx) { @@ -824,67 +821,73 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I atUint8 flip = 0; for (int v = 0; v < vertCount - 2; ++v) { if (flip) { - os.format(FMT_STRING( - "last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, " - "two_face_vert)\n"), - primVerts[c % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[c % 3].norm, - primVerts[(c + 2) % 3].norm, primVerts[(c + 1) % 3].norm, sHead.matIdx); + os.format(FMT_STRING("last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, " + "({},{},{}), {}, od_list, " + "two_face_vert)\n"), + primVerts[c % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[(c + 1) % 3].pos, + primVerts[c % 3].norm, primVerts[(c + 2) % 3].norm, primVerts[(c + 1) % 3].norm, + sHead.matIdx); if (matUVCount) { os << "if last_face is not None:\n"; for (unsigned j = 0; j < matUVCount; ++j) { if (j == 0 && matShortUVs) - os.format(FMT_STRING( - " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " - "suv_list[{}])\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[0]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[1]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[2]\n"), + os.format( + FMT_STRING( + " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " + "suv_list[{}])\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[0]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[1]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[2]\n"), primVerts[c % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], primVerts[c % 3].pos, j, primVerts[(c + 2) % 3].pos, j, primVerts[(c + 1) % 3].pos, j); else - os.format(FMT_STRING( - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n"), + os.format( + FMT_STRING( + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n"), primVerts[c % 3].pos, j, primVerts[c % 3].uvs[j], primVerts[(c + 2) % 3].pos, j, primVerts[(c + 2) % 3].uvs[j], primVerts[(c + 1) % 3].pos, j, primVerts[(c + 1) % 3].uvs[j]); } } } else { - os.format(FMT_STRING( - "last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, " - "two_face_vert)\n"), - primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[c % 3].norm, - primVerts[(c + 1) % 3].norm, primVerts[(c + 2) % 3].norm, sHead.matIdx); + os.format(FMT_STRING("last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, " + "({},{},{}), {}, od_list, " + "two_face_vert)\n"), + primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[(c + 2) % 3].pos, + primVerts[c % 3].norm, primVerts[(c + 1) % 3].norm, primVerts[(c + 2) % 3].norm, + sHead.matIdx); if (matUVCount) { os << "if last_face is not None:\n"; for (unsigned j = 0; j < matUVCount; ++j) { if (j == 0 && matShortUVs) - os.format(FMT_STRING( - " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " - "suv_list[{}])\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[0]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[1]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[2]\n"), + os.format( + FMT_STRING( + " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " + "suv_list[{}])\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[0]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[1]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[2]\n"), primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j], primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j, primVerts[(c + 2) % 3].pos, j); else - os.format(FMT_STRING( - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n"), + os.format( + FMT_STRING( + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n"), primVerts[c % 3].pos, j, primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].pos, j, primVerts[(c + 1) % 3].uvs[j], primVerts[(c + 2) % 3].pos, j, primVerts[(c + 2) % 3].uvs[j]); } @@ -901,34 +904,36 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I } else if (ptype == GX::TRIANGLES) { for (int v = 0; v < vertCount; v += 3) { - os.format(FMT_STRING( - "last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, " - "two_face_vert)\n"), - primVerts[0].pos, primVerts[1].pos, primVerts[2].pos, primVerts[0].norm, primVerts[1].norm, - primVerts[2].norm, sHead.matIdx); + os.format(FMT_STRING("last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, " + "({},{},{}), {}, od_list, " + "two_face_vert)\n"), + primVerts[0].pos, primVerts[1].pos, primVerts[2].pos, primVerts[0].norm, primVerts[1].norm, + primVerts[2].norm, sHead.matIdx); if (matUVCount) { os << "if last_face is not None:\n"; for (unsigned j = 0; j < matUVCount; ++j) { if (j == 0 && matShortUVs) - os.format(FMT_STRING( - " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " - "suv_list[{}])\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[0]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[1]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[2]\n"), + os.format( + FMT_STRING( + " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " + "suv_list[{}])\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[0]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[1]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[2]\n"), primVerts[0].uvs[j], primVerts[1].uvs[j], primVerts[2].uvs[j], primVerts[0].pos, j, primVerts[1].pos, j, primVerts[2].pos, j); else - os.format(FMT_STRING( - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n"), + os.format( + FMT_STRING( + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n"), primVerts[0].pos, j, primVerts[0].uvs[j], primVerts[1].pos, j, primVerts[1].uvs[j], primVerts[2].pos, j, primVerts[2].uvs[j]); } @@ -945,34 +950,36 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I } else if (ptype == GX::TRIANGLEFAN) { ++c; for (int v = 0; v < vertCount - 2; ++v) { - os.format(FMT_STRING( - "last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, " - "two_face_vert)\n"), - firstPrimVert.pos, primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, firstPrimVert.norm, - primVerts[c % 3].norm, primVerts[(c + 1) % 3].norm, sHead.matIdx); + os.format(FMT_STRING("last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, " + "({},{},{}), {}, od_list, " + "two_face_vert)\n"), + firstPrimVert.pos, primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, firstPrimVert.norm, + primVerts[c % 3].norm, primVerts[(c + 1) % 3].norm, sHead.matIdx); if (matUVCount) { os << "if last_face is not None:\n"; for (unsigned j = 0; j < matUVCount; ++j) { if (j == 0 && matShortUVs) - os.format(FMT_STRING( - " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " - "suv_list[{}])\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[0]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[1]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_tri[2]\n"), + os.format( + FMT_STRING( + " uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], " + "suv_list[{}])\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[0]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[1]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_tri[2]\n"), firstPrimVert.uvs[j], primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], firstPrimVert.pos, j, primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j); else - os.format(FMT_STRING( - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n" - " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " - "uv_list[{}]\n"), + os.format( + FMT_STRING( + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n" + " loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = " + "uv_list[{}]\n"), firstPrimVert.pos, j, firstPrimVert.uvs[j], primVerts[c % 3].pos, j, primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].pos, j, primVerts[(c + 1) % 3].uvs[j]); } @@ -1060,13 +1067,12 @@ bool ReadCMDLToBlender(hecl::blender::Connection& conn, athena::io::IStreamReade /* Open Py Stream and read sections */ hecl::blender::PyOutStream os = conn.beginPythonOut(true); - os.format(FMT_STRING( - "import bpy\n" - "import bmesh\n" - "\n" - "bpy.context.scene.name = '{}'\n" - "bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"), - pakRouter.getBestEntryName(entry)); + os.format(FMT_STRING("import bpy\n" + "import bmesh\n" + "\n" + "bpy.context.scene.name = '{}'\n" + "bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"), + pakRouter.getBestEntryName(entry)); InitGeomBlenderContext(os, dataspec.getMasterShaderPath()); MaterialSet::RegisterMaterialProps(os); @@ -1083,25 +1089,29 @@ bool ReadCMDLToBlender(hecl::blender::Connection& conn, athena::io::IStreamReade } template bool ReadCMDLToBlender, DNAMP1::MaterialSet, - std::pair, std::pair>, DNACMDL::SurfaceHeader_1, 2>( + std::pair, std::pair>, + DNACMDL::SurfaceHeader_1, 2>( hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter& pakRouter, const PAKRouter::EntryType& entry, const SpecBase& dataspec, const std::pair, std::pair>& rp); template bool ReadCMDLToBlender, DNAMP2::MaterialSet, - std::pair, std::pair>, DNACMDL::SurfaceHeader_2, 4>( + std::pair, std::pair>, + DNACMDL::SurfaceHeader_2, 4>( hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter& pakRouter, const PAKRouter::EntryType& entry, const SpecBase& dataspec, const std::pair, std::pair>& rp); template bool ReadCMDLToBlender, DNAMP3::MaterialSet, - std::pair, std::pair>, DNACMDL::SurfaceHeader_3, 4>( + std::pair, std::pair>, + DNACMDL::SurfaceHeader_3, 4>( hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter& pakRouter, const PAKRouter::EntryType& entry, const SpecBase& dataspec, const std::pair, std::pair>& rp); template bool ReadCMDLToBlender, DNAMP3::MaterialSet, - std::pair, std::pair>, DNACMDL::SurfaceHeader_3, 5>( + std::pair, std::pair>, + DNACMDL::SurfaceHeader_3, 5>( hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter& pakRouter, const PAKRouter::EntryType& entry, const SpecBase& dataspec, const std::pair, std::pair>& rp); @@ -1592,9 +1602,10 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in return true; } -template bool WriteHMDLCMDL( - const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh, - hecl::blender::PoolSkinIndex& poolSkinIndex); +template bool +WriteHMDLCMDL(const hecl::ProjectPath& outPath, + const hecl::ProjectPath& inPath, const Mesh& mesh, + hecl::blender::PoolSkinIndex& poolSkinIndex); struct MaterialPool { std::vector materials; diff --git a/DataSpec/DNACommon/CMakeLists.txt b/DataSpec/DNACommon/CMakeLists.txt index 116564f8a..d2211d761 100644 --- a/DataSpec/DNACommon/CMakeLists.txt +++ b/DataSpec/DNACommon/CMakeLists.txt @@ -1,60 +1,60 @@ make_dnalist(CMDL - FONT - DGRP - FSM2 - MAPA - MAPU - PATH - MayaSpline - EGMC - SAVWCommon - ParticleCommon - MetaforceVersionInfo - Tweaks/ITweakPlayerGun) + FONT + DGRP + FSM2 + MAPA + MAPU + PATH + MayaSpline + EGMC + SAVWCommon + ParticleCommon + MetaforceVersionInfo + Tweaks/ITweakPlayerGun) set(DNACOMMON_SOURCES - DNACommon.hpp DNACommon.cpp - PAK.hpp PAK.cpp - GX.hpp GX.cpp - FSM2.hpp FSM2.cpp - MLVL.hpp MLVL.cpp - CMDL.cpp - MAPA.cpp - MAPU.cpp - PATH.hpp PATH.cpp - STRG.hpp STRG.cpp - TXTR.hpp TXTR.cpp - ANCS.hpp ANCS.cpp - ANIM.hpp ANIM.cpp - PART.hpp PART.cpp - SWHC.hpp SWHC.cpp - CRSC.hpp CRSC.cpp - ELSC.hpp ELSC.cpp - WPSC.hpp WPSC.cpp - DPSC.hpp DPSC.cpp - ParticleCommon.cpp - FONT.cpp - DGRP.cpp - ATBL.hpp ATBL.cpp - DeafBabe.hpp DeafBabe.cpp - BabeDead.hpp BabeDead.cpp - RigInverter.hpp RigInverter.cpp - AROTBuilder.hpp AROTBuilder.cpp - OBBTreeBuilder.hpp OBBTreeBuilder.cpp - MetaforceVersionInfo.hpp - Tweaks/ITweak.hpp - Tweaks/TweakWriter.hpp - Tweaks/ITweakGame.hpp - Tweaks/ITweakParticle.hpp - Tweaks/ITweakPlayer.hpp - Tweaks/ITweakPlayerControl.hpp - Tweaks/ITweakGunRes.hpp - Tweaks/ITweakPlayerRes.hpp - Tweaks/ITweakGui.hpp - Tweaks/ITweakSlideShow.hpp - Tweaks/ITweakTargeting.hpp - Tweaks/ITweakAutoMapper.hpp - Tweaks/ITweakBall.hpp - Tweaks/ITweakGuiColors.hpp) + DNACommon.hpp DNACommon.cpp + PAK.hpp PAK.cpp + GX.hpp GX.cpp + FSM2.hpp FSM2.cpp + MLVL.hpp MLVL.cpp + CMDL.cpp + MAPA.cpp + MAPU.cpp + PATH.hpp PATH.cpp + STRG.hpp STRG.cpp + TXTR.hpp TXTR.cpp + ANCS.hpp ANCS.cpp + ANIM.hpp ANIM.cpp + PART.hpp PART.cpp + SWHC.hpp SWHC.cpp + CRSC.hpp CRSC.cpp + ELSC.hpp ELSC.cpp + WPSC.hpp WPSC.cpp + DPSC.hpp DPSC.cpp + ParticleCommon.cpp + FONT.cpp + DGRP.cpp + ATBL.hpp ATBL.cpp + DeafBabe.hpp DeafBabe.cpp + BabeDead.hpp BabeDead.cpp + RigInverter.hpp RigInverter.cpp + AROTBuilder.hpp AROTBuilder.cpp + OBBTreeBuilder.hpp OBBTreeBuilder.cpp + MetaforceVersionInfo.hpp + Tweaks/ITweak.hpp + Tweaks/TweakWriter.hpp + Tweaks/ITweakGame.hpp + Tweaks/ITweakParticle.hpp + Tweaks/ITweakPlayer.hpp + Tweaks/ITweakPlayerControl.hpp + Tweaks/ITweakGunRes.hpp + Tweaks/ITweakPlayerRes.hpp + Tweaks/ITweakGui.hpp + Tweaks/ITweakSlideShow.hpp + Tweaks/ITweakTargeting.hpp + Tweaks/ITweakAutoMapper.hpp + Tweaks/ITweakBall.hpp + Tweaks/ITweakGuiColors.hpp) dataspec_add_list(DNACommon DNACOMMON_SOURCES) diff --git a/DataSpec/DNACommon/CRSC.hpp b/DataSpec/DNACommon/CRSC.hpp index bab40f942..94ba917ed 100644 --- a/DataSpec/DNACommon/CRSC.hpp +++ b/DataSpec/DNACommon/CRSC.hpp @@ -27,18 +27,22 @@ struct _CRSM { #define FLOAT_ENTRY(name, identifier) float identifier = 0.f; #include "CRSC.def" - template + template void constexpr Enumerate(_Func f) { #define ENTRY(name, identifier) f(FOURCC(name), identifier); #include "CRSC.def" } - template + template bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { -#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true; +#define ENTRY(name, identifier) \ + case SBIG(name): \ + f(identifier); \ + return true; #include "CRSC.def" - default: return false; + default: + return false; } } }; diff --git a/DataSpec/DNACommon/DNACommon.cpp b/DataSpec/DNACommon/DNACommon.cpp index 6174765ba..603079fe3 100644 --- a/DataSpec/DNACommon/DNACommon.cpp +++ b/DataSpec/DNACommon/DNACommon.cpp @@ -29,9 +29,8 @@ hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const IDType& id, bool si LogDNACommon.report(logvisor::Warning, FMT_STRING("unable to translate {} to path"), id); return {}; } - LogDNACommon.report(logvisor::Fatal, - FMT_STRING("g_PakRouter or s_Project must be set to non-null before " - "calling UniqueIDBridge::TranslatePakIdToPath")); + LogDNACommon.report(logvisor::Fatal, FMT_STRING("g_PakRouter or s_Project must be set to non-null before " + "calling UniqueIDBridge::TranslatePakIdToPath")); return {}; } @@ -53,7 +52,8 @@ hecl::ProjectPath UniqueIDBridge::MakePathFromString(std::string_view str) { return {}; hecl::Database::Project* project = s_Project.get(); if (!project) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("UniqueIDBridge::setGlobalProject must be called before MakePathFromString")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("UniqueIDBridge::setGlobalProject must be called before MakePathFromString")); hecl::ProjectPath path = hecl::ProjectPath(*project, str); project->addBridgePathToCache(IDType(path).toUint64(), path); return path; @@ -90,9 +90,7 @@ void UniqueID32::Enumerate(typename BinarySize::StreamT& s) s += 4; } -std::string UniqueID32::toString() const { - return fmt::format(FMT_STRING("{}"), *this); -} +std::string UniqueID32::toString() const { return fmt::format(FMT_STRING("{}"), *this); } template <> void UniqueID32Zero::Enumerate(typename Read::StreamT& reader) { @@ -142,9 +140,7 @@ void UniqueID64::Enumerate(typename BinarySize::StreamT& s) s += 8; } -std::string UniqueID64::toString() const { - return fmt::format(FMT_STRING("{}"), *this); -} +std::string UniqueID64::toString() const { return fmt::format(FMT_STRING("{}"), *this); } /** PAK 128-bit Unique ID */ template <> @@ -175,9 +171,7 @@ void UniqueID128::Enumerate(typename BinarySize::StreamT& s) s += 16; } -std::string UniqueID128::toString() const { - return fmt::format(FMT_STRING("{}"), *this); -} +std::string UniqueID128::toString() const { return fmt::format(FMT_STRING("{}"), *this); } /** Word Bitmap reader/writer */ void WordBitmap::read(athena::io::IStreamReader& reader, size_t bitCount) { diff --git a/DataSpec/DNACommon/DNACommon.hpp b/DataSpec/DNACommon/DNACommon.hpp index 6ef5263fb..bf469e3f7 100644 --- a/DataSpec/DNACommon/DNACommon.hpp +++ b/DataSpec/DNACommon/DNACommon.hpp @@ -144,7 +144,7 @@ public: copy[8] = '\0'; assign(strtoul(copy, nullptr, 16)); } - UniqueID32(const wchar_t* hexStr) noexcept{ + UniqueID32(const wchar_t* hexStr) noexcept { wchar_t copy[9]; wcsncpy(copy, hexStr, 8); copy[8] = L'\0'; @@ -345,8 +345,12 @@ using ResCooker = std::function struct CharacterAssociations { - struct RigPair { IDType cskr, cinf; }; - struct ModelRigPair { IDType cinf, cmdl; }; + struct RigPair { + IDType cskr, cinf; + }; + struct ModelRigPair { + IDType cinf, cmdl; + }; /* CMDL -> (CSKR, CINF) */ std::unordered_map m_cmdlRigs; /* CSKR -> ANCS */ @@ -377,17 +381,17 @@ inline hecl::ProjectPath GetPathBeginsWith(const hecl::ProjectPath& parentPath, namespace std { template <> struct hash { - size_t operator()(const DataSpec::DNAFourCC& fcc) const noexcept{ return fcc.toUint32(); } + size_t operator()(const DataSpec::DNAFourCC& fcc) const noexcept { return fcc.toUint32(); } }; template <> struct hash { - size_t operator()(const DataSpec::UniqueID32& id) const noexcept{ return id.toUint32(); } + size_t operator()(const DataSpec::UniqueID32& id) const noexcept { return id.toUint32(); } }; template <> struct hash { - size_t operator()(const DataSpec::UniqueID64& id) const noexcept{ return id.toUint64(); } + size_t operator()(const DataSpec::UniqueID64& id) const noexcept { return id.toUint64(); } }; template <> diff --git a/DataSpec/DNACommon/DPSC.hpp b/DataSpec/DNACommon/DPSC.hpp index 2ef2c547c..56de7d9e6 100644 --- a/DataSpec/DNACommon/DPSC.hpp +++ b/DataSpec/DNACommon/DPSC.hpp @@ -45,18 +45,22 @@ struct _DPSM { bool x5c_24_DMAB = false; bool x5c_25_DMOO = false; - template + template void constexpr Enumerate(_Func f) { #define ENTRY(name, identifier) f(FOURCC(name), identifier); #include "DPSC.def" } - template + template bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { -#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true; +#define ENTRY(name, identifier) \ + case SBIG(name): \ + f(identifier); \ + return true; #include "DPSC.def" - default: return false; + default: + return false; } } }; diff --git a/DataSpec/DNACommon/DeafBabe.cpp b/DataSpec/DNACommon/DeafBabe.cpp index c18bb7162..51aa1bd4e 100644 --- a/DataSpec/DNACommon/DeafBabe.cpp +++ b/DataSpec/DNACommon/DeafBabe.cpp @@ -53,20 +53,19 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b os.format(FMT_STRING("tri_verts.append(col_bm.verts[{}])\n"), vindices[1]); os.format(FMT_STRING("tri_verts.append(col_bm.verts[{}])\n"), vindices[2]); - os.format(FMT_STRING( - "face = col_bm.faces.get(tri_verts)\n" - "if face is None:\n" - " face = col_bm.faces.new(tri_verts)\n" - "else:\n" - " face = face.copy()\n" - " 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{:016X}" - ")\n" - "face.smooth = False\n" - "\n"), - atUint64(triMat.material)); + os.format(FMT_STRING("face = col_bm.faces.get(tri_verts)\n" + "if face is None:\n" + " face = col_bm.faces.new(tri_verts)\n" + "else:\n" + " face = face.copy()\n" + " 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{:016X}" + ")\n" + "face.smooth = False\n" + "\n"), + atUint64(triMat.material)); } db.insertNoClimb(os); diff --git a/DataSpec/DNACommon/ELSC.hpp b/DataSpec/DNACommon/ELSC.hpp index a6eaaf41d..e6881d9c0 100644 --- a/DataSpec/DNACommon/ELSC.hpp +++ b/DataSpec/DNACommon/ELSC.hpp @@ -25,18 +25,22 @@ struct _ELSM { #define BOOL_ENTRY(name, identifier) bool identifier = false; #include "ELSC.def" - template + template void constexpr Enumerate(_Func f) { #define ENTRY(name, identifier) f(FOURCC(name), identifier); #include "ELSC.def" } - template + template bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { -#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true; +#define ENTRY(name, identifier) \ + case SBIG(name): \ + f(identifier); \ + return true; #include "ELSC.def" - default: return false; + default: + return false; } } }; diff --git a/DataSpec/DNACommon/GX.cpp b/DataSpec/DNACommon/GX.cpp index f296883b7..88a3809ab 100644 --- a/DataSpec/DNACommon/GX.cpp +++ b/DataSpec/DNACommon/GX.cpp @@ -15,4 +15,4 @@ void Color::Enumerate::BinarySize>(BinarySi s += 4; } -} \ No newline at end of file +} // namespace GX \ No newline at end of file diff --git a/DataSpec/DNACommon/GX.hpp b/DataSpec/DNACommon/GX.hpp index 5bcb7b7d7..dc56be6ed 100644 --- a/DataSpec/DNACommon/GX.hpp +++ b/DataSpec/DNACommon/GX.hpp @@ -295,5 +295,4 @@ struct Color : athena::io::DNA { AT_DECL_EXPLICIT_DNA }; -} - +} // namespace GX diff --git a/DataSpec/DNACommon/MAPA.cpp b/DataSpec/DNACommon/MAPA.cpp index 3fb81f506..b668d6b6b 100644 --- a/DataSpec/DNACommon/MAPA.cpp +++ b/DataSpec/DNACommon/MAPA.cpp @@ -146,10 +146,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const " edge.seam = True\n" "\n"; - os.format(FMT_STRING( - "bpy.context.scene.name = 'MAPA_{}'\n" - "bpy.context.scene.retro_map_vis_mode = '{}'\n"), - entry.id, RetroMapVisModes[mapa.header->visMode()]); + os.format(FMT_STRING("bpy.context.scene.name = 'MAPA_{}'\n" + "bpy.context.scene.retro_map_vis_mode = '{}'\n"), + entry.id, RetroMapVisModes[mapa.header->visMode()]); /* Add empties representing MappableObjects */ int moIdx = 0; @@ -159,21 +158,20 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const zeus::simd_floats mtxF[3]; for (int i = 0; i < 3; ++i) moMP12->transformMtx[i].simd.copy_to(mtxF[i]); - os.format(FMT_STRING( - "obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n" - "bpy.context.scene.collection.objects.link(obj)\n" - "obj.retro_mappable_type = {}\n" - "obj.retro_mapobj_vis_mode = '{}'\n" - "obj.retro_mappable_sclyid = '0x{:08X}'\n" - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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"), - moIdx, int(moMP12->type), RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1], - mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2], - mtxF[2][3]); + os.format(FMT_STRING("obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n" + "bpy.context.scene.collection.objects.link(obj)\n" + "obj.retro_mappable_type = {}\n" + "obj.retro_mapobj_vis_mode = '{}'\n" + "obj.retro_mappable_sclyid = '0x{:08X}'\n" + "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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"), + moIdx, int(moMP12->type), RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1], + mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], + mtxF[2][2], mtxF[2][3]); ++moIdx; continue; } else { @@ -181,21 +179,20 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const zeus::simd_floats mtxF[3]; for (int i = 0; i < 3; ++i) moMP3->transformMtx[i].simd.copy_to(mtxF[i]); - os.format(FMT_STRING( - "obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n" - "bpy.context.scene.collection.objects.link(obj)\n" - "obj.retro_mappable_type = {}\n" - "obj.retro_mapobj_vis_mode = '{}'\n" - "obj.retro_mappable_sclyid = '0x{:08X}'\n" - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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"), - moIdx, int(moMP3->type), RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1], - mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2], - mtxF[2][3]); + os.format(FMT_STRING("obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n" + "bpy.context.scene.collection.objects.link(obj)\n" + "obj.retro_mappable_type = {}\n" + "obj.retro_mapobj_vis_mode = '{}'\n" + "obj.retro_mappable_sclyid = '0x{:08X}'\n" + "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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"), + moIdx, int(moMP3->type), RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1], + mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], + mtxF[2][2], mtxF[2][3]); ++moIdx; continue; } @@ -278,15 +275,14 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const const zeus::CMatrix4f* tmpMtx = pakRouter.lookupMAPATransform(entry.id); const zeus::CMatrix4f& mtx = tmpMtx ? *tmpMtx : zeus::skIdentityMatrix4f; - os.format(FMT_STRING( - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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"), - mtx[0][0], mtx[1][0], mtx[2][0], mtx[3][0], mtx[0][1], mtx[1][1], mtx[2][1], mtx[3][1], mtx[0][2], mtx[1][2], - mtx[2][2], mtx[3][2]); + os.format(FMT_STRING("mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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"), + mtx[0][0], mtx[1][0], mtx[2][0], mtx[3][0], mtx[0][1], mtx[1][1], mtx[2][1], mtx[3][1], mtx[0][2], + mtx[1][2], mtx[2][2], mtx[3][2]); /* World background */ hecl::ProjectPath worldDir = outPath.getParentPath().getParentPath(); diff --git a/DataSpec/DNACommon/MAPU.cpp b/DataSpec/DNACommon/MAPU.cpp index bed0b8a6f..21684decc 100644 --- a/DataSpec/DNACommon/MAPU.cpp +++ b/DataSpec/DNACommon/MAPU.cpp @@ -43,37 +43,35 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, const MAPU& mapu, const for (int i = 0; i < 3; ++i) wldXf.xf[i].simd.copy_to(wldXfF[i]); zeus::simd_floats hexColorF(wld.hexColor.mSimd); - os.format(FMT_STRING( - "wldObj = bpy.data.objects.new('{}', None)\n" - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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 = ({}, {}, {}, {})\n" - "wldObj.retro_mapworld_path = '''{}'''\n" - "bpy.context.scene.collection.objects.link(wldObj)\n"), - wld.name, wldXfF[0][0], wldXfF[0][1], wldXfF[0][2], wldXfF[0][3], wldXfF[1][0], wldXfF[1][1], - wldXfF[1][2], wldXfF[1][3], wldXfF[2][0], wldXfF[2][1], wldXfF[2][2], wldXfF[2][3], hexColorF[0], hexColorF[1], - hexColorF[2], hexColorF[3], path.getParentPath().getRelativePathUTF8()); + os.format(FMT_STRING("wldObj = bpy.data.objects.new('{}', None)\n" + "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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 = ({}, {}, {}, {})\n" + "wldObj.retro_mapworld_path = '''{}'''\n" + "bpy.context.scene.collection.objects.link(wldObj)\n"), + wld.name, wldXfF[0][0], wldXfF[0][1], wldXfF[0][2], wldXfF[0][3], wldXfF[1][0], wldXfF[1][1], + wldXfF[1][2], wldXfF[1][3], wldXfF[2][0], wldXfF[2][1], wldXfF[2][2], wldXfF[2][3], hexColorF[0], + hexColorF[1], hexColorF[2], hexColorF[3], path.getParentPath().getRelativePathUTF8()); int idx = 0; for (const MAPU::Transform& hexXf : wld.hexTransforms) { zeus::simd_floats hexXfF[3]; for (int i = 0; i < 3; ++i) hexXf.xf[i].simd.copy_to(hexXfF[i]); - os.format(FMT_STRING( - "obj = bpy.data.objects.new('{}_{}', hexMesh)\n" - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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.collection.objects.link(obj)\n" - "obj.parent = wldObj\n"), - wld.name, idx++, hexXfF[0][0], hexXfF[0][1], hexXfF[0][2], hexXfF[0][3], hexXfF[1][0], hexXfF[1][1], - hexXfF[1][2], hexXfF[1][3], hexXfF[2][0], hexXfF[2][1], hexXfF[2][2], hexXfF[2][3]); + os.format(FMT_STRING("obj = bpy.data.objects.new('{}_{}', hexMesh)\n" + "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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.collection.objects.link(obj)\n" + "obj.parent = wldObj\n"), + wld.name, idx++, hexXfF[0][0], hexXfF[0][1], hexXfF[0][2], hexXfF[0][3], hexXfF[1][0], hexXfF[1][1], + hexXfF[1][2], hexXfF[1][3], hexXfF[2][0], hexXfF[2][1], hexXfF[2][2], hexXfF[2][3]); } } diff --git a/DataSpec/DNACommon/MAPU.hpp b/DataSpec/DNACommon/MAPU.hpp index 88214f8e7..55fe10610 100644 --- a/DataSpec/DNACommon/MAPU.hpp +++ b/DataSpec/DNACommon/MAPU.hpp @@ -11,7 +11,7 @@ class ProjectPath; namespace hecl::blender { class Connection; struct MapUniverse; -} // namespce hecl::blender +} // namespace hecl::blender namespace DataSpec::DNAMAPU { struct MAPU : BigDNA { diff --git a/DataSpec/DNACommon/MLVL.cpp b/DataSpec/DNACommon/MLVL.cpp index 94df2d0ca..c90330ed7 100644 --- a/DataSpec/DNACommon/MLVL.cpp +++ b/DataSpec/DNACommon/MLVL.cpp @@ -41,20 +41,19 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const zeus::simd_floats xfMtxF[3]; for (int i = 0; i < 3; ++i) area.transformMtx[i].simd.copy_to(xfMtxF[i]); - os.format(FMT_STRING( - "box_mesh = bpy.data.meshes.new('''{}''')\n" - "bm.to_mesh(box_mesh)\n" - "bm.free()\n" - "box = bpy.data.objects.new(box_mesh.name, box_mesh)\n" - "bpy.context.scene.collection.objects.link(box)\n" - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n" - "mtxd = mtx.decompose()\n" - "box.rotation_mode = 'QUATERNION'\n" - "box.location = mtxd[0]\n" - "box.rotation_quaternion = mtxd[1]\n" - "box.scale = mtxd[2]\n"), - areaDirName, xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], xfMtxF[0][3], xfMtxF[1][0], xfMtxF[1][1], - xfMtxF[1][2], xfMtxF[1][3], xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], xfMtxF[2][3]); + os.format(FMT_STRING("box_mesh = bpy.data.meshes.new('''{}''')\n" + "bm.to_mesh(box_mesh)\n" + "bm.free()\n" + "box = bpy.data.objects.new(box_mesh.name, box_mesh)\n" + "bpy.context.scene.collection.objects.link(box)\n" + "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n" + "mtxd = mtx.decompose()\n" + "box.rotation_mode = 'QUATERNION'\n" + "box.location = mtxd[0]\n" + "box.rotation_quaternion = mtxd[1]\n" + "box.scale = mtxd[2]\n"), + areaDirName, xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], xfMtxF[0][3], xfMtxF[1][0], xfMtxF[1][1], + xfMtxF[1][2], xfMtxF[1][3], xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], xfMtxF[2][3]); /* Insert dock planes */ int dockIdx = 0; @@ -67,10 +66,9 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const int idx = 0; for (const atVec3f& pv : dock.planeVerts) { const zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg; - os.format(FMT_STRING( - "bm.verts.new(({},{},{}))\n" - "bm.verts.ensure_lookup_table()\n"), - pvRel[0], pvRel[1], pvRel[2]); + os.format(FMT_STRING("bm.verts.new(({},{},{}))\n" + "bm.verts.ensure_lookup_table()\n"), + pvRel[0], pvRel[1], pvRel[2]); if (idx) os << "bm.edges.new((bm.verts[-2], bm.verts[-1]))\n"; ++idx; diff --git a/DataSpec/DNACommon/MayaSpline.hpp b/DataSpec/DNACommon/MayaSpline.hpp index 700f78833..11de1f0bf 100644 --- a/DataSpec/DNACommon/MayaSpline.hpp +++ b/DataSpec/DNACommon/MayaSpline.hpp @@ -23,4 +23,4 @@ struct MayaSpline : public BigDNA { Value minAmp; Value maxAmp; }; -} \ No newline at end of file +} // namespace DataSpec \ No newline at end of file diff --git a/DataSpec/DNACommon/PAK.cpp b/DataSpec/DNACommon/PAK.cpp index c285742cf..46b8ffde9 100644 --- a/DataSpec/DNACommon/PAK.cpp +++ b/DataSpec/DNACommon/PAK.cpp @@ -207,7 +207,8 @@ void PAKRouter::enterPAKBridge(const BRIDGETYPE& pakBridge) { ++pit; ++bridgeIdx; } - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()")); } template @@ -310,8 +311,8 @@ hecl::ProjectPath PAKRouter::getCooked(const EntryType* entry) const auto overrideSearch = m_overrideEntries.find(entry->id); if (overrideSearch != m_overrideEntries.end()) { - return overrideSearch->second.getCookedPath(*m_dataSpec.overrideDataSpec( - overrideSearch->second, m_dataSpec.getDataSpecEntry())); + return overrideSearch->second.getCookedPath( + *m_dataSpec.overrideDataSpec(overrideSearch->second, m_dataSpec.getDataSpecEntry())); } const PAKType* pak = m_pak.get(); @@ -352,8 +353,9 @@ hecl::SystemString PAKRouter::getResourceRelativePath(const EntryTyp const nod::Node* node = m_node.get(); const PAKType* pak = m_pak.get(); if (!pak) - LogDNACommon.report(logvisor::Fatal, - FMT_STRING("PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()")); + LogDNACommon.report( + logvisor::Fatal, + FMT_STRING("PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()")); const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b); if (!be) return hecl::SystemString(); @@ -487,15 +489,15 @@ bool PAKRouter::extractResources(const BRIDGETYPE& pakBridge, bool f } template -const typename BRIDGETYPE::PAKType::Entry* PAKRouter::lookupEntry(const IDType& entry, - const nod::Node** nodeOut, - bool silenceWarnings, - bool currentPAK) const { +const typename BRIDGETYPE::PAKType::Entry* +PAKRouter::lookupEntry(const IDType& entry, const nod::Node** nodeOut, bool silenceWarnings, + bool currentPAK) const { if (!entry.isValid()) return nullptr; if (!m_bridges) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::lookupEntry()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKRouter::build() must be called before PAKRouter::lookupEntry()")); const PAKType* pak = m_pak.get(); const nod::Node* node = m_node.get(); @@ -561,7 +563,8 @@ const zeus::CMatrix4f* PAKRouter::lookupMAPATransform(const IDType& template hecl::ProjectPath PAKRouter::getAreaLayerWorking(const IDType& areaId, int layerIdx) const { if (!m_bridges) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()")); auto bridgePathIt = m_bridgePaths.cbegin(); for (const BRIDGETYPE& bridge : *m_bridges) { for (const auto& level : bridge.m_levelDeps) @@ -583,7 +586,8 @@ hecl::ProjectPath PAKRouter::getAreaLayerWorking(const IDType& areaI bool& activeOut) const { activeOut = false; if (!m_bridges) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()")); auto bridgePathIt = m_bridgePaths.cbegin(); for (const BRIDGETYPE& bridge : *m_bridges) { for (const auto& level : bridge.m_levelDeps) @@ -605,7 +609,8 @@ hecl::ProjectPath PAKRouter::getAreaLayerWorking(const IDType& areaI template hecl::ProjectPath PAKRouter::getAreaLayerCooked(const IDType& areaId, int layerIdx) const { if (!m_bridges) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()")); auto bridgePathIt = m_bridgePaths.cbegin(); for (const BRIDGETYPE& bridge : *m_bridges) { for (const auto& level : bridge.m_levelDeps) @@ -626,7 +631,8 @@ template hecl::ProjectPath PAKRouter::getAreaLayerCooked(const IDType& areaId, int layerIdx, bool& activeOut) const { activeOut = false; if (!m_bridges) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()")); auto bridgePathIt = m_bridgePaths.cbegin(); for (const BRIDGETYPE& bridge : *m_bridges) { for (const auto& level : bridge.m_levelDeps) @@ -648,7 +654,8 @@ hecl::ProjectPath PAKRouter::getAreaLayerCooked(const IDType& areaId template void PAKRouter::enumerateResources(const std::function& func) { if (!m_bridges) - LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::enumerateResources()")); + LogDNACommon.report(logvisor::Fatal, + FMT_STRING("PAKRouter::build() must be called before PAKRouter::enumerateResources()")); for (const auto& entryPair : m_uniqueEntries) if (!func(entryPair.second.second)) return; @@ -661,8 +668,9 @@ template bool PAKRouter::mreaHasDupeResources(const IDType& id) const { const PAKType* pak = m_pak.get(); if (!pak) - LogDNACommon.report(logvisor::Fatal, - FMT_STRING("PAKRouter::enterPAKBridge() must be called before PAKRouter::mreaHasDupeResources()")); + LogDNACommon.report( + logvisor::Fatal, + FMT_STRING("PAKRouter::enterPAKBridge() must be called before PAKRouter::mreaHasDupeResources()")); return pak->mreaHasDupeResources(id); } diff --git a/DataSpec/DNACommon/PART.hpp b/DataSpec/DNACommon/PART.hpp index 8c30dc28d..679f6dfe2 100644 --- a/DataSpec/DNACommon/PART.hpp +++ b/DataSpec/DNACommon/PART.hpp @@ -32,19 +32,23 @@ struct _GPSM { #define BOOL_ENTRY(name, identifier, def) bool identifier = def; #include "PART.def" - template + template void constexpr Enumerate(_Func f) { #define ENTRY(name, identifier) f(FOURCC(name), identifier); #define BOOL_ENTRY(name, identifier, def) f(FOURCC(name), identifier, def); #include "PART.def" } - template + template bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { -#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true; +#define ENTRY(name, identifier) \ + case SBIG(name): \ + f(identifier); \ + return true; #include "PART.def" - default: return false; + default: + return false; } } }; diff --git a/DataSpec/DNACommon/PATH.cpp b/DataSpec/DNACommon/PATH.cpp index 212cdad6f..eeaa8cfd6 100644 --- a/DataSpec/DNACommon/PATH.cpp +++ b/DataSpec/DNACommon/PATH.cpp @@ -91,13 +91,13 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string os.format(FMT_STRING("tri_verts.append(bm.verts[{}])\n"), r.nodeStart + i); os.format(FMT_STRING("face = bm.faces.get(tri_verts)\n" - "if face is None:\n" - " face = bm.faces.new(tri_verts)\n" - " face.normal_flip()\n" - "face.material_index = select_material(0x{:04X}, 0x{:04X})\n" - "face.smooth = False\n" - "face[height_lay] = {}\n" - "\n"), + "if face is None:\n" + " face = bm.faces.new(tri_verts)\n" + " face.normal_flip()\n" + "face.material_index = select_material(0x{:04X}, 0x{:04X})\n" + "face.smooth = False\n" + "face[height_lay] = {}\n" + "\n"), r.meshIndexMask, r.meshTypeMask, r.height); #if 0 @@ -151,11 +151,11 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string for (int i = 0; i < 4; ++i) w.m[i].mSimd.copy_to(xfMtxF[i]); os.format(FMT_STRING("mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n" - "mtxd = mtx.decompose()\n" - "path_mesh_obj.rotation_mode = 'QUATERNION'\n" - "path_mesh_obj.location = mtxd[0]\n" - "path_mesh_obj.rotation_quaternion = mtxd[1]\n" - "path_mesh_obj.scale = mtxd[2]\n"), + "mtxd = mtx.decompose()\n" + "path_mesh_obj.rotation_mode = 'QUATERNION'\n" + "path_mesh_obj.location = mtxd[0]\n" + "path_mesh_obj.rotation_quaternion = mtxd[1]\n" + "path_mesh_obj.scale = mtxd[2]\n"), xfMtxF[0][0], xfMtxF[1][0], xfMtxF[2][0], xfMtxF[3][0], xfMtxF[0][1], xfMtxF[1][1], xfMtxF[2][1], xfMtxF[3][1], xfMtxF[0][2], xfMtxF[1][2], xfMtxF[2][2], xfMtxF[3][2]); } diff --git a/DataSpec/DNACommon/ParticleCommon.hpp b/DataSpec/DNACommon/ParticleCommon.hpp index 711ba1026..950c52a7b 100644 --- a/DataSpec/DNACommon/ParticleCommon.hpp +++ b/DataSpec/DNACommon/ParticleCommon.hpp @@ -28,7 +28,7 @@ template struct PPImpl : BigDNA, _Basis { AT_DECL_EXPLICIT_DNA_YAML - template + template static constexpr bool _shouldStore(T& p, bool defaultBool) { if constexpr (std::is_same_v) { return p != defaultBool; @@ -51,23 +51,23 @@ struct PPImpl : BigDNA, _Basis { clsId.read(r); while (clsId != SBIG('_END')) { if (!_Basis::Lookup(clsId, [&](auto& p) { - using Tp = std::decay_t; - if constexpr (std::is_same_v) { - DNAFourCC tp(r); - if (tp == SBIG('CNST')) - p = r.readBool(); - } else if constexpr (std::is_same_v) { - DNAFourCC tp(r); - if (tp == SBIG('CNST')) - p = r.readUint32Big(); - } else if constexpr (std::is_same_v) { - DNAFourCC tp(r); - if (tp == SBIG('CNST')) - p = r.readFloatBig(); - } else { - p.read(r); - } - })) { + using Tp = std::decay_t; + if constexpr (std::is_same_v) { + DNAFourCC tp(r); + if (tp == SBIG('CNST')) + p = r.readBool(); + } else if constexpr (std::is_same_v) { + DNAFourCC tp(r); + if (tp == SBIG('CNST')) + p = r.readUint32Big(); + } else if constexpr (std::is_same_v) { + DNAFourCC tp(r); + if (tp == SBIG('CNST')) + p = r.readFloatBig(); + } else { + p.read(r); + } + })) { LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {} @{}"), RefType, clsId, r.position()); } clsId.read(r); @@ -131,17 +131,17 @@ struct PPImpl : BigDNA, _Basis { if (auto rec = r.enterSubRecord(key)) { const DNAFourCC clsId = key.c_str(); if (!_Basis::Lookup(clsId, [&](auto& p) { - using Tp = std::decay_t; - if constexpr (std::is_same_v) { - p = r.readBool(); - } else if constexpr (std::is_same_v) { - p = r.readUint32(); - } else if constexpr (std::is_same_v) { - p = r.readFloat(); - } else { - p.read(r); - } - })) { + using Tp = std::decay_t; + if constexpr (std::is_same_v) { + p = r.readBool(); + } else if constexpr (std::is_same_v) { + p = r.readUint32(); + } else if constexpr (std::is_same_v) { + p = r.readFloat(); + } else { + p.read(r); + } + })) { LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {}"), RefType, clsId); } } @@ -197,10 +197,10 @@ struct PEImpl : BigDNA { return; } if (!_Basis::Lookup(clsId, [&](auto&& p) { - using Tp = std::decay_t; - m_elem = std::make_unique(); - m_elem->read(r); - })) { + using Tp = std::decay_t; + m_elem = std::make_unique(); + m_elem->read(r); + })) { LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {} @{}"), _PtrType::TypeName, clsId, r.position()); } } @@ -234,10 +234,10 @@ struct PEImpl : BigDNA { if (auto rec = r.enterSubRecord(key)) { const DNAFourCC clsId = key.c_str(); if (!_Basis::Lookup(clsId, [&](auto&& p) { - using Tp = std::decay_t; - m_elem = std::make_unique(); - m_elem->read(r); - })) { + using Tp = std::decay_t; + m_elem = std::make_unique(); + m_elem->read(r); + })) { LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {}"), _PtrType::TypeName, clsId); } } @@ -249,14 +249,13 @@ struct PEImpl : BigDNA { m_elem->write(w); } - void gatherDependencies(std::vector& deps) const { - _Basis::gatherDependencies(deps, m_elem); - } + void gatherDependencies(std::vector& deps) const { _Basis::gatherDependencies(deps, m_elem); } explicit operator bool() const { return m_elem.operator bool(); } auto* get() const { return m_elem.get(); } auto* operator->() const { return get(); } void reset() { m_elem.reset(); } + private: std::unique_ptr<_PtrType> m_elem; }; @@ -308,44 +307,113 @@ struct RECEXT; struct REIntTimesReal; struct _RealElementFactory { using PtrType = IRealElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('LFTW'): f(PEType{}); return true; - case SBIG('CNST'): f(PEType{}); return true; - case SBIG('CHAN'): f(PEType{}); return true; - case SBIG('ADD_'): f(PEType{}); return true; - case SBIG('CLMP'): f(PEType{}); return true; - case SBIG('KEYE'): f(PEType{}); return true; - case SBIG('KEYP'): f(PEType{}); return true; - case SBIG('IRND'): f(PEType{}); return true; - case SBIG('RAND'): f(PEType{}); return true; - case SBIG('MULT'): f(PEType{}); return true; - case SBIG('PULS'): f(PEType{}); return true; - case SBIG('SCAL'): f(PEType{}); return true; - case SBIG('RLPT'): f(PEType{}); return true; - case SBIG('SINE'): f(PEType{}); return true; - case SBIG('ISWT'): f(PEType{}); return true; - case SBIG('CLTN'): f(PEType{}); return true; - case SBIG('CEQL'): f(PEType{}); return true; - case SBIG('PAP1'): f(PEType{}); return true; - case SBIG('PAP2'): f(PEType{}); return true; - case SBIG('PAP3'): f(PEType{}); return true; - case SBIG('PAP4'): f(PEType{}); return true; - case SBIG('PAP5'): f(PEType{}); return true; - case SBIG('PAP6'): f(PEType{}); return true; - case SBIG('PAP7'): f(PEType{}); return true; - case SBIG('PAP8'): f(PEType{}); return true; - case SBIG('PSLL'): f(PEType{}); return true; - case SBIG('PRLW'): f(PEType{}); return true; - case SBIG('SUB_'): f(PEType{}); return true; - case SBIG('VMAG'): f(PEType{}); return true; - case SBIG('VXTR'): f(PEType{}); return true; - case SBIG('VYTR'): f(PEType{}); return true; - case SBIG('VZTR'): f(PEType{}); return true; - case SBIG('CEXT'): f(PEType{}); return true; - case SBIG('ITRL'): f(PEType{}); return true; - default: return false; + case SBIG('LFTW'): + f(PEType{}); + return true; + case SBIG('CNST'): + f(PEType{}); + return true; + case SBIG('CHAN'): + f(PEType{}); + return true; + case SBIG('ADD_'): + f(PEType{}); + return true; + case SBIG('CLMP'): + f(PEType{}); + return true; + case SBIG('KEYE'): + f(PEType{}); + return true; + case SBIG('KEYP'): + f(PEType{}); + return true; + case SBIG('IRND'): + f(PEType{}); + return true; + case SBIG('RAND'): + f(PEType{}); + return true; + case SBIG('MULT'): + f(PEType{}); + return true; + case SBIG('PULS'): + f(PEType{}); + return true; + case SBIG('SCAL'): + f(PEType{}); + return true; + case SBIG('RLPT'): + f(PEType{}); + return true; + case SBIG('SINE'): + f(PEType{}); + return true; + case SBIG('ISWT'): + f(PEType{}); + return true; + case SBIG('CLTN'): + f(PEType{}); + return true; + case SBIG('CEQL'): + f(PEType{}); + return true; + case SBIG('PAP1'): + f(PEType{}); + return true; + case SBIG('PAP2'): + f(PEType{}); + return true; + case SBIG('PAP3'): + f(PEType{}); + return true; + case SBIG('PAP4'): + f(PEType{}); + return true; + case SBIG('PAP5'): + f(PEType{}); + return true; + case SBIG('PAP6'): + f(PEType{}); + return true; + case SBIG('PAP7'): + f(PEType{}); + return true; + case SBIG('PAP8'): + f(PEType{}); + return true; + case SBIG('PSLL'): + f(PEType{}); + return true; + case SBIG('PRLW'): + f(PEType{}); + return true; + case SBIG('SUB_'): + f(PEType{}); + return true; + case SBIG('VMAG'): + f(PEType{}); + return true; + case SBIG('VXTR'): + f(PEType{}); + return true; + case SBIG('VYTR'): + f(PEType{}); + return true; + case SBIG('VZTR'): + f(PEType{}); + return true; + case SBIG('CEXT'): + f(PEType{}); + return true; + case SBIG('ITRL'): + f(PEType{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, @@ -377,28 +445,65 @@ struct IEModulo; struct IESubtract; struct _IntElementFactory { using PtrType = IIntElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('KEYE'): f(PEType{}); return true; - case SBIG('KEYP'): f(PEType{}); return true; - case SBIG('DETH'): f(PEType{}); return true; - case SBIG('CLMP'): f(PEType{}); return true; - case SBIG('CHAN'): f(PEType{}); return true; - case SBIG('ADD_'): f(PEType{}); return true; - case SBIG('CNST'): f(PEType{}); return true; - case SBIG('IMPL'): f(PEType{}); return true; - case SBIG('ILPT'): f(PEType{}); return true; - case SBIG('IRND'): f(PEType{}); return true; - case SBIG('PULS'): f(PEType{}); return true; - case SBIG('MULT'): f(PEType{}); return true; - case SBIG('SPAH'): f(PEType{}); return true; - case SBIG('RAND'): f(PEType{}); return true; - case SBIG('TSCL'): f(PEType{}); return true; - case SBIG('GTCP'): f(PEType{}); return true; - case SBIG('MODU'): f(PEType{}); return true; - case SBIG('SUB_'): f(PEType{}); return true; - default: return false; + case SBIG('KEYE'): + f(PEType{}); + return true; + case SBIG('KEYP'): + f(PEType{}); + return true; + case SBIG('DETH'): + f(PEType{}); + return true; + case SBIG('CLMP'): + f(PEType{}); + return true; + case SBIG('CHAN'): + f(PEType{}); + return true; + case SBIG('ADD_'): + f(PEType{}); + return true; + case SBIG('CNST'): + f(PEType{}); + return true; + case SBIG('IMPL'): + f(PEType{}); + return true; + case SBIG('ILPT'): + f(PEType{}); + return true; + case SBIG('IRND'): + f(PEType{}); + return true; + case SBIG('PULS'): + f(PEType{}); + return true; + case SBIG('MULT'): + f(PEType{}); + return true; + case SBIG('SPAH'): + f(PEType{}); + return true; + case SBIG('RAND'): + f(PEType{}); + return true; + case SBIG('TSCL'): + f(PEType{}); + return true; + case SBIG('GTCP'): + f(PEType{}); + return true; + case SBIG('MODU'): + f(PEType{}); + return true; + case SBIG('SUB_'): + f(PEType{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, @@ -430,28 +535,65 @@ struct VEPSOR; struct VEPSOF; struct _VectorElementFactory { using PtrType = IVectorElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('CONE'): f(PEType{}); return true; - case SBIG('CHAN'): f(PEType{}); return true; - case SBIG('ANGC'): f(PEType{}); return true; - case SBIG('ADD_'): f(PEType{}); return true; - case SBIG('CCLU'): f(PEType{}); return true; - case SBIG('CNST'): f(PEType{}); return true; - case SBIG('CIRC'): f(PEType{}); return true; - case SBIG('KEYE'): f(PEType{}); return true; - case SBIG('KEYP'): f(PEType{}); return true; - case SBIG('MULT'): f(PEType{}); return true; - case SBIG('RTOV'): f(PEType{}); return true; - case SBIG('PULS'): f(PEType{}); return true; - case SBIG('PVEL'): f(PEType{}); return true; - case SBIG('SPOS'): f(PEType{}); return true; - case SBIG('PLCO'): f(PEType{}); return true; - case SBIG('PLOC'): f(PEType{}); return true; - case SBIG('PSOR'): f(PEType{}); return true; - case SBIG('PSOF'): f(PEType{}); return true; - default: return false; + case SBIG('CONE'): + f(PEType{}); + return true; + case SBIG('CHAN'): + f(PEType{}); + return true; + case SBIG('ANGC'): + f(PEType{}); + return true; + case SBIG('ADD_'): + f(PEType{}); + return true; + case SBIG('CCLU'): + f(PEType{}); + return true; + case SBIG('CNST'): + f(PEType{}); + return true; + case SBIG('CIRC'): + f(PEType{}); + return true; + case SBIG('KEYE'): + f(PEType{}); + return true; + case SBIG('KEYP'): + f(PEType{}); + return true; + case SBIG('MULT'): + f(PEType{}); + return true; + case SBIG('RTOV'): + f(PEType{}); + return true; + case SBIG('PULS'): + f(PEType{}); + return true; + case SBIG('PVEL'): + f(PEType{}); + return true; + case SBIG('SPOS'): + f(PEType{}); + return true; + case SBIG('PLCO'): + f(PEType{}); + return true; + case SBIG('PLOC'): + f(PEType{}); + return true; + case SBIG('PSOR'): + f(PEType{}); + return true; + case SBIG('PSOF'): + f(PEType{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, @@ -472,17 +614,32 @@ struct CEFade; struct CEPulse; struct _ColorElementFactory { using PtrType = IColorElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('KEYE'): f(PEType{}); return true; - case SBIG('KEYP'): f(PEType{}); return true; - case SBIG('CNST'): f(PEType{}); return true; - case SBIG('CHAN'): f(PEType{}); return true; - case SBIG('CFDE'): f(PEType{}); return true; - case SBIG('FADE'): f(PEType{}); return true; - case SBIG('PULS'): f(PEType{}); return true; - default: return false; + case SBIG('KEYE'): + f(PEType{}); + return true; + case SBIG('KEYP'): + f(PEType{}); + return true; + case SBIG('CNST'): + f(PEType{}); + return true; + case SBIG('CHAN'): + f(PEType{}); + return true; + case SBIG('CFDE'): + f(PEType{}); + return true; + case SBIG('FADE'): + f(PEType{}); + return true; + case SBIG('PULS'): + f(PEType{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, @@ -508,22 +665,47 @@ struct MVEWind; struct MVESwirl; struct _ModVectorElementFactory { using PtrType = IModVectorElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('IMPL'): f(PEType{}); return true; - case SBIG('EMPL'): f(PEType{}); return true; - case SBIG('CHAN'): f(PEType{}); return true; - case SBIG('BNCE'): f(PEType{}); return true; - case SBIG('CNST'): f(PEType{}); return true; - case SBIG('GRAV'): f(PEType{}); return true; - case SBIG('EXPL'): f(PEType{}); return true; - case SBIG('SPOS'): f(PEType{}); return true; - case SBIG('LMPL'): f(PEType{}); return true; - case SBIG('PULS'): f(PEType{}); return true; - case SBIG('WIND'): f(PEType{}); return true; - case SBIG('SWRL'): f(PEType{}); return true; - default: return false; + case SBIG('IMPL'): + f(PEType{}); + return true; + case SBIG('EMPL'): + f(PEType{}); + return true; + case SBIG('CHAN'): + f(PEType{}); + return true; + case SBIG('BNCE'): + f(PEType{}); + return true; + case SBIG('CNST'): + f(PEType{}); + return true; + case SBIG('GRAV'): + f(PEType{}); + return true; + case SBIG('EXPL'): + f(PEType{}); + return true; + case SBIG('SPOS'): + f(PEType{}); + return true; + case SBIG('LMPL'): + f(PEType{}); + return true; + case SBIG('PULS'): + f(PEType{}); + return true; + case SBIG('WIND'): + f(PEType{}); + return true; + case SBIG('SWRL'): + f(PEType{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, @@ -541,14 +723,23 @@ struct VESphere; struct VEAngleSphere; struct _EmitterElementFactory { using PtrType = IEmitterElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('SETR'): f(PEType{}); return true; - case SBIG('SEMR'): f(PEType{}); return true; - case SBIG('SPHE'): f(PEType{}); return true; - case SBIG('ASPH'): f(PEType{}); return true; - default: return false; + case SBIG('SETR'): + f(PEType{}); + return true; + case SBIG('SEMR'): + f(PEType{}); + return true; + case SBIG('SPHE'): + f(PEType{}); + return true; + case SBIG('ASPH'): + f(PEType{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, @@ -1296,12 +1487,17 @@ struct UVEAnimTexture : IUVElement { template struct _UVElementFactory { using PtrType = IUVElement; - template + template static bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { - case SBIG('CNST'): f(PEType>{}); return true; - case SBIG('ATEX'): f(PEType>{}); return true; - default: return false; + case SBIG('CNST'): + f(PEType>{}); + return true; + case SBIG('ATEX'): + f(PEType>{}); + return true; + default: + return false; } } static constexpr void gatherDependencies(std::vector& pathsOut, diff --git a/DataSpec/DNACommon/STRG.cpp b/DataSpec/DNACommon/STRG.cpp index 868f808b0..fd8fa07e5 100644 --- a/DataSpec/DNACommon/STRG.cpp +++ b/DataSpec/DNACommon/STRG.cpp @@ -8,7 +8,8 @@ namespace DataSpec { -void ISTRG::gatherDependencies(std::vector& pathsOut) const { /* TODO: parse out resource tokens */ } +void ISTRG::gatherDependencies(std::vector& pathsOut) const { /* TODO: parse out resource tokens */ +} std::unique_ptr LoadSTRG(athena::io::IStreamReader& reader) { uint32_t magic = reader.readUint32Big(); diff --git a/DataSpec/DNACommon/SWHC.hpp b/DataSpec/DNACommon/SWHC.hpp index 269828ed2..2665a56ea 100644 --- a/DataSpec/DNACommon/SWHC.hpp +++ b/DataSpec/DNACommon/SWHC.hpp @@ -28,19 +28,23 @@ struct _SWSH { #define BOOL_ENTRY(name, identifier, def) bool identifier = def; #include "SWHC.def" - template + template void constexpr Enumerate(_Func f) { #define ENTRY(name, identifier) f(FOURCC(name), identifier); #define BOOL_ENTRY(name, identifier, def) f(FOURCC(name), identifier, def); #include "SWHC.def" } - template + template bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { -#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true; +#define ENTRY(name, identifier) \ + case SBIG(name): \ + f(identifier); \ + return true; #include "SWHC.def" - default: return false; + default: + return false; } } }; diff --git a/DataSpec/DNACommon/TXTR.cpp b/DataSpec/DNACommon/TXTR.cpp index e45654b81..657b0e5c2 100644 --- a/DataSpec/DNACommon/TXTR.cpp +++ b/DataSpec/DNACommon/TXTR.cpp @@ -252,7 +252,7 @@ static void DecodeIA4(png_structp png, png_infop info, const uint8_t* texels, in for (int y = height - 1; y >= 0; --y) { for (int x = 0; x < width; ++x) { const uint8_t texel = Lookup8BPP(texels, width, x, y); - buf[x * 2 ] = Convert4To8(texel & 0xf); + buf[x * 2] = Convert4To8(texel & 0xf); buf[x * 2 + 1] = Convert4To8(texel >> 4 & 0xf); } png_write_row(png, buf.get()); @@ -1067,7 +1067,8 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat } if (setjmp(png_jmpbuf(pngRead))) { - Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath()); + Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to initialize libpng I/O for '{}'")), + inPath.getAbsolutePath()); png_destroy_read_struct(&pngRead, &info, nullptr); return false; } @@ -1386,7 +1387,8 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP } if (setjmp(png_jmpbuf(pngRead))) { - Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath()); + Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to initialize libpng I/O for '{}'")), + inPath.getAbsolutePath()); png_destroy_read_struct(&pngRead, &info, nullptr); return false; } @@ -1627,9 +1629,7 @@ void DataSpec::TXTR::PaletteMeta::Enumerate(typename Op::StreamT& s) { AT_SPECIALIZE_DNA_YAML(DataSpec::TXTR::PaletteMeta) -std::string_view DataSpec::TXTR::PaletteMeta::DNAType() { - return "DataSpec::TXTR::PaletteMeta"sv; -} +std::string_view DataSpec::TXTR::PaletteMeta::DNAType() { return "DataSpec::TXTR::PaletteMeta"sv; } template void DataSpec::TXTR::Meta::Enumerate(typename Op::StreamT& s) { @@ -1645,13 +1645,9 @@ void DataSpec::TXTR::Meta::Enumerate(typename Op::StreamT& s) { AT_SPECIALIZE_DNA_YAML(DataSpec::TXTR::Meta) -std::string_view DataSpec::TXTR::Meta::DNAType() { - return "DataSpec::TXTR::Meta"sv; -} +std::string_view DataSpec::TXTR::Meta::DNAType() { return "DataSpec::TXTR::Meta"sv; } -static const atInt32 RetroToDol[11] { - 0, 1, 2, 3, 8, 9, -1, 4, 5, 6, 14 -}; +static const atInt32 RetroToDol[11]{0, 1, 2, 3, 8, 9, -1, 4, 5, 6, 14}; TXTR::Meta TXTR::GetMetaData(DataSpec::PAKEntryReadStream& rs) { const atUint32 retroFormat = rs.readUint32Big(); @@ -1679,8 +1675,8 @@ TXTR::Meta TXTR::GetMetaData(DataSpec::PAKEntryReadStream& rs) { rs.readUBytesToBuf(palData.get(), palSize); palMeta.dolphinHash = XXH64(palData.get(), palSize, 0); } else { - switch(format) { - case 0: // I4 + switch (format) { + case 0: // I4 case 14: // DXT1 textureSize /= 2; break; diff --git a/DataSpec/DNACommon/Tweaks/ITweakGui.hpp b/DataSpec/DNACommon/Tweaks/ITweakGui.hpp index 6f8fc7950..9ea42cd27 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakGui.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakGui.hpp @@ -126,10 +126,10 @@ struct ITweakGui : ITweak { virtual float GetHudLightAttMulLinear() const = 0; virtual float GetHudLightAttMulQuadratic() const = 0; virtual std::string_view GetCreditsTable() const = 0; - virtual std::string_view GetCreditsFont() const =0; - virtual std::string_view GetJapaneseCreditsFont() const=0; - virtual const zeus::CColor& GetCreditsTextFontColor() const=0; - virtual const zeus::CColor& GetCreditsTextBorderColor() const=0; + virtual std::string_view GetCreditsFont() const = 0; + virtual std::string_view GetJapaneseCreditsFont() const = 0; + virtual const zeus::CColor& GetCreditsTextFontColor() const = 0; + virtual const zeus::CColor& GetCreditsTextBorderColor() const = 0; static float FaceReflectionDistanceDebugValueToActualValue(float v) { return 0.015f * v + 0.2f; } static float FaceReflectionHeightDebugValueToActualValue(float v) { return 0.005f * v - 0.05f; } diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp index 328f645ee..6e0b689d3 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp @@ -21,8 +21,8 @@ struct ITweakPlayerRes : ITweak { ResId x18_minesBreakSecondTopIcon; ResId x1c_minesBreakSecondBottomIcon; - ResId rs5_mapArrowUp; - ResId rs5_mapArrowDown; + ResId rs5_mapArrowUp; + ResId rs5_mapArrowDown; /* N, U, UL, L, DL, D, DR, R, UR */ std::array x24_lStick; diff --git a/DataSpec/DNACommon/WPSC.hpp b/DataSpec/DNACommon/WPSC.hpp index 6a387ef7a..8b1490b02 100644 --- a/DataSpec/DNACommon/WPSC.hpp +++ b/DataSpec/DNACommon/WPSC.hpp @@ -28,19 +28,23 @@ struct _WPSM { #define BOOL_ENTRY(name, identifier, def) bool identifier = def; #include "WPSC.def" - template + template void constexpr Enumerate(_Func f) { #define ENTRY(name, identifier) f(FOURCC(name), identifier); #define BOOL_ENTRY(name, identifier, def) f(FOURCC(name), identifier, def); #include "WPSC.def" } - template + template bool constexpr Lookup(FourCC fcc, _Func f) { switch (fcc.toUint32()) { -#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true; +#define ENTRY(name, identifier) \ + case SBIG(name): \ + f(identifier); \ + return true; #include "WPSC.def" - default: return false; + default: + return false; } } }; diff --git a/DataSpec/DNAMP1/AFSM.cpp b/DataSpec/DNAMP1/AFSM.cpp index 72dd25570..8ddefe59c 100644 --- a/DataSpec/DNAMP1/AFSM.cpp +++ b/DataSpec/DNAMP1/AFSM.cpp @@ -99,8 +99,6 @@ void AFSM::State::Transition::Trigger::Enumerate(size_t& __i __isz += (first ? 8 : 4); } -std::string_view AFSM::State::Transition::Trigger::DNAType() { - return "DNAMP1::AFSM::State::Transition::Trigger"sv; -} +std::string_view AFSM::State::Transition::Trigger::DNAType() { return "DNAMP1::AFSM::State::Transition::Trigger"sv; } } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/ANCS.cpp b/DataSpec/DNAMP1/ANCS.cpp index b21a68a44..dc3053674 100644 --- a/DataSpec/DNAMP1/ANCS.cpp +++ b/DataSpec/DNAMP1/ANCS.cpp @@ -605,9 +605,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate(athena::io: } } -std::string_view ANCS::CharacterSet::CharacterInfo::DNAType() { - return "DNAMP1::ANCS::CharacterSet::CharacterInfo"sv; -} +std::string_view ANCS::CharacterSet::CharacterInfo::DNAType() { return "DNAMP1::ANCS::CharacterSet::CharacterInfo"sv; } template <> void ANCS::AnimationSet::MetaAnimFactory::Enumerate(athena::io::IStreamReader& reader) { @@ -1049,8 +1047,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat ch.cskrIce = inPath.ensureAuxInfo( fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, cskrSys)); } else { - ch.cskrIce = inPath.ensureAuxInfo( - fmt::format(FMT_STRING(_SYS_STR("{}.{}.CSKR")), chSysName, overlaySys)); + ch.cskrIce = inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}.CSKR")), chSysName, overlaySys)); } } } @@ -1101,8 +1098,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat ancs.animationSet.animResources.back().animId = pathOut; /* Check for associated EVNT YAML */ - hecl::SystemString testPrefix(inPath.getWithExtension( - fmt::format(FMT_STRING(_SYS_STR(".{}_")), sysStr).c_str(), true).getLastComponent()); + hecl::SystemString testPrefix( + inPath.getWithExtension(fmt::format(FMT_STRING(_SYS_STR(".{}_")), sysStr).c_str(), true).getLastComponent()); hecl::ProjectPath evntYamlPath; for (const auto& ent : dEnum) { if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) && @@ -1126,8 +1123,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat static const hecl::SystemRegex regCskrNameId(_SYS_STR(R"((.*)_[0-9a-fA-F]{8}\.CSKR)"), std::regex::ECMAScript | std::regex::optimize); -static const hecl::SystemRegex regCskrName(_SYS_STR(R"((.*)\.CSKR)"), - std::regex::ECMAScript | std::regex::optimize); +static const hecl::SystemRegex regCskrName(_SYS_STR(R"((.*)\.CSKR)"), std::regex::ECMAScript | std::regex::optimize); bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor, const std::function& modelCookFunc) { @@ -1220,8 +1216,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i const std::string& name = boneNames[bIdx]; auto search = boneIdMap.find(name); if (search == boneIdMap.cend()) - Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name, - inPath.getRelativePathUTF8()); + Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name, inPath.getRelativePathUTF8()); virtualBone.first.emplace_back(search->second, weight); } virtualBone.second = skinIO.readUint32Big(); @@ -1359,8 +1354,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath& const std::string& name = boneNames[bIdx]; auto search = boneIdMap.find(name); if (search == boneIdMap.cend()) - Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name, - inPath.getRelativePathUTF8()); + Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name, inPath.getRelativePathUTF8()); virtualBone.emplace_back(search->second, weight); } } @@ -1380,8 +1374,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath& const std::string& name = boneNames[bIdx]; auto search = boneIdMap.find(name); if (search == boneIdMap.cend()) - Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name, - inPath.getRelativePathUTF8()); + Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name, inPath.getRelativePathUTF8()); skinOut.writeUint32Big(search->second); } } @@ -1403,8 +1396,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath& static const hecl::SystemRegex regAnimNameId(_SYS_STR(R"((.*)_[0-9a-fA-F]{8}\.ANIM)"), std::regex::ECMAScript | std::regex::optimize); -static const hecl::SystemRegex regAnimName(_SYS_STR(R"((.*)\.ANIM)"), - std::regex::ECMAScript | std::regex::optimize); +static const hecl::SystemRegex regAnimName(_SYS_STR(R"((.*)\.ANIM)"), std::regex::ECMAScript | std::regex::optimize); bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor, hecl::blender::DataStream& ds, bool pc) { @@ -1438,8 +1430,8 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i ANIM anim(action, boneIdMap, *rigInv, pc); /* Check for associated EVNT YAML */ - hecl::SystemString testPrefix(inPath.getWithExtension( - fmt::format(FMT_STRING(_SYS_STR(".{}_")), actName).c_str(), true).getLastComponent()); + hecl::SystemString testPrefix( + inPath.getWithExtension(fmt::format(FMT_STRING(_SYS_STR(".{}_")), actName).c_str(), true).getLastComponent()); hecl::ProjectPath evntYamlPath; for (const auto& ent : hecl::DirectoryEnumerator(inPath.getParentPath().getAbsolutePath())) { if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) && diff --git a/DataSpec/DNAMP1/ANIM.cpp b/DataSpec/DNAMP1/ANIM.cpp index b00bb3988..7768ec25c 100644 --- a/DataSpec/DNAMP1/ANIM.cpp +++ b/DataSpec/DNAMP1/ANIM.cpp @@ -7,10 +7,9 @@ namespace DataSpec::DNAMP1 { using ANIMOutStream = hecl::blender::ANIMOutStream; void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter& rig) const { - os.format(FMT_STRING( - "act.hecl_fps = round({})\n" - "act.hecl_looping = {}\n"), - (1.0f / mainInterval), looping ? "True" : "False"); + os.format(FMT_STRING("act.hecl_fps = round({})\n" + "act.hecl_looping = {}\n"), + (1.0f / mainInterval), looping ? "True" : "False"); auto kit = chanKeys.begin(); diff --git a/DataSpec/DNAMP1/CINF.cpp b/DataSpec/DNAMP1/CINF.cpp index 9eec50834..27bbeed83 100644 --- a/DataSpec/DNAMP1/CINF.cpp +++ b/DataSpec/DNAMP1/CINF.cpp @@ -44,26 +44,24 @@ void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const { void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const { DNAANIM::RigInverter inverter(*this); - os.format(FMT_STRING( - "arm = bpy.data.armatures.new('CINF_{}')\n" - "arm_obj = bpy.data.objects.new(arm.name, arm)\n" - "bpy.context.scene.collection.objects.link(arm_obj)\n" - "bpy.context.view_layer.objects.active = arm_obj\n" - "bpy.ops.object.mode_set(mode='EDIT')\n" - "arm_bone_table = {{}}\n"), - cinfId); + os.format(FMT_STRING("arm = bpy.data.armatures.new('CINF_{}')\n" + "arm_obj = bpy.data.objects.new(arm.name, arm)\n" + "bpy.context.scene.collection.objects.link(arm_obj)\n" + "bpy.context.view_layer.objects.active = arm_obj\n" + "bpy.ops.object.mode_set(mode='EDIT')\n" + "arm_bone_table = {{}}\n"), + cinfId); for (const DNAANIM::RigInverter::Bone& bone : inverter.getBones()) { zeus::simd_floats originF(bone.m_origBone.origin.simd); zeus::simd_floats tailF(bone.m_tail.mSimd); - os.format(FMT_STRING( - "bone = arm.edit_bones.new('{}')\n" - "bone.head = ({},{},{})\n" - "bone.tail = ({},{},{})\n" - "bone.use_inherit_scale = False\n" - "arm_bone_table[{}] = bone\n"), - *getBoneNameFromId(bone.m_origBone.id), originF[0], originF[1], originF[2], tailF[0], tailF[1], - tailF[2], bone.m_origBone.id); + os.format(FMT_STRING("bone = arm.edit_bones.new('{}')\n" + "bone.head = ({},{},{})\n" + "bone.tail = ({},{},{})\n" + "bone.use_inherit_scale = False\n" + "arm_bone_table[{}] = bone\n"), + *getBoneNameFromId(bone.m_origBone.id), originF[0], originF[1], originF[2], tailF[0], tailF[1], tailF[2], + bone.m_origBone.id); } for (const Bone& bone : bones) @@ -168,14 +166,15 @@ bool CINF::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: auto os = conn.beginPythonOut(true); os.format(FMT_STRING("import bpy\n" - "from mathutils import Vector\n" - "bpy.context.scene.name = 'CINF_{}'\n" - "bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n" - "\n" - "# Clear Scene\n" - "if len(bpy.data.collections):\n" - " bpy.data.collections.remove(bpy.data.collections[0])\n" - "\n"), entry.id); + "from mathutils import Vector\n" + "bpy.context.scene.name = 'CINF_{}'\n" + "bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n" + "\n" + "# Clear Scene\n" + "if len(bpy.data.collections):\n" + " bpy.data.collections.remove(bpy.data.collections[0])\n" + "\n"), + entry.id); CINF cinf; cinf.read(rs); diff --git a/DataSpec/DNAMP1/CMDLMaterials.cpp b/DataSpec/DNAMP1/CMDLMaterials.cpp index e8d0babd4..f08f50cdc 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.cpp +++ b/DataSpec/DNAMP1/CMDLMaterials.cpp @@ -35,9 +35,9 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t texLabel = "Texture"; out.format(FMT_STRING("# Texture\n" - "tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n" - "tex_node.label = '{} {}'\n" - "texture_nodes.append(tex_node)\n"), + "tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n" + "tex_node.label = '{} {}'\n" + "texture_nodes.append(tex_node)\n"), texLabel, texIdx); if (texIdx != 0xff) @@ -51,10 +51,11 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n"; else if (type >= GX::TG_TEX0 && type <= GX::TG_TEX7) { uint8_t texIdx = type - GX::TG_TEX0; - out.format(FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n" + out.format( + FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n" "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n" "tex_uv_node.uv_map = 'UV_{}'\n"), - texIdx); + texIdx); } out.format(FMT_STRING("tex_uv_node.label = '{}'\n"), mtxLabel); @@ -71,160 +72,160 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx, switch (type) { case UVAnimation::Mode::MvInvNoTranslation: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode0NodeN']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode0NodeN']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx); break; case UVAnimation::Mode::MvInv: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode1NodeN']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode1NodeN']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx); break; case UVAnimation::Mode::Scroll: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode2Node']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " node.inputs[1].default_value = ({},{},0)\n" - " node.inputs[2].default_value = ({},{},0)\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode2Node']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " node.inputs[1].default_value = ({},{},0)\n" + " node.inputs[2].default_value = ({},{},0)\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx, vals[0], vals[1], vals[2], vals[3]); break; case UVAnimation::Mode::Rotation: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode3Node']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " node.inputs[1].default_value = {}\n" - " node.inputs[2].default_value = {}\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode3Node']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " node.inputs[1].default_value = {}\n" + " node.inputs[2].default_value = {}\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx, vals[0], vals[1]); break; case UVAnimation::Mode::HStrip: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode4Node']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " node.inputs[1].default_value = {}\n" - " node.inputs[2].default_value = {}\n" - " node.inputs[3].default_value = {}\n" - " node.inputs[4].default_value = {}\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode4Node']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " node.inputs[1].default_value = {}\n" + " node.inputs[2].default_value = {}\n" + " node.inputs[3].default_value = {}\n" + " node.inputs[4].default_value = {}\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx, vals[0], vals[1], vals[2], vals[3]); break; case UVAnimation::Mode::VStrip: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode5Node']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " node.inputs[1].default_value = {}\n" - " node.inputs[2].default_value = {}\n" - " node.inputs[3].default_value = {}\n" - " node.inputs[4].default_value = {}\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode5Node']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " node.inputs[1].default_value = {}\n" + " node.inputs[2].default_value = {}\n" + " node.inputs[3].default_value = {}\n" + " node.inputs[4].default_value = {}\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx, vals[0], vals[1], vals[2], vals[3]); break; case UVAnimation::Mode::Model: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode6NodeN']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode6NodeN']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx); break; case UVAnimation::Mode::CylinderEnvironment: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode7NodeN']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " node.inputs[1].default_value = {}\n" - " node.inputs[2].default_value = {}\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode7NodeN']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " node.inputs[1].default_value = {}\n" + " node.inputs[2].default_value = {}\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx, vals[0], vals[1]); break; case UVAnimation::Mode::Eight: out.format(FMT_STRING("for link in list(tex_links):\n" - " if link.from_node.label == 'MTX_{}':\n" - " tex_links.remove(link)\n" - " soc_from = link.from_socket\n" - " soc_to = link.to_socket\n" - " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" - " node.node_tree = bpy.data.node_groups['RetroUVMode8Node']\n" - " node.location[0] = link.from_node.location[0] + 50\n" - " node.location[1] = link.from_node.location[1] - 50\n" - " node.inputs[1].default_value = {}\n" - " node.inputs[2].default_value = {}\n" - " node.inputs[3].default_value = {}\n" - " node.inputs[4].default_value = {}\n" - " node.inputs[5].default_value = {}\n" - " node.inputs[6].default_value = {}\n" - " node.inputs[7].default_value = {}\n" - " node.inputs[8].default_value = {}\n" - " node.inputs[9].default_value = {}\n" - " new_nodetree.links.remove(link)\n" - " new_nodetree.links.new(soc_from, node.inputs[0])\n" - " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), + " if link.from_node.label == 'MTX_{}':\n" + " tex_links.remove(link)\n" + " soc_from = link.from_socket\n" + " soc_to = link.to_socket\n" + " node = new_nodetree.nodes.new('ShaderNodeGroup')\n" + " node.node_tree = bpy.data.node_groups['RetroUVMode8Node']\n" + " node.location[0] = link.from_node.location[0] + 50\n" + " node.location[1] = link.from_node.location[1] - 50\n" + " node.inputs[1].default_value = {}\n" + " node.inputs[2].default_value = {}\n" + " node.inputs[3].default_value = {}\n" + " node.inputs[4].default_value = {}\n" + " node.inputs[5].default_value = {}\n" + " node.inputs[6].default_value = {}\n" + " node.inputs[7].default_value = {}\n" + " node.inputs[8].default_value = {}\n" + " node.inputs[9].default_value = {}\n" + " new_nodetree.links.remove(link)\n" + " new_nodetree.links.new(soc_from, node.inputs[0])\n" + " new_nodetree.links.new(node.outputs[0], soc_to)\n\n"), idx, vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8]); break; default: @@ -234,8 +235,8 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx, void Material::AddKcolor(Stream& out, const GX::Color& col, unsigned idx) { out.format(FMT_STRING("kcolors[{}] = ({}, {}, {}, {})\n" - "kalphas[{}] = {}\n" - "\n"), + "kalphas[{}] = {}\n" + "\n"), idx, (float)col.color[0] / (float)0xff, (float)col.color[1] / (float)0xff, (float)col.color[2] / (float)0xff, (float)col.color[3] / (float)0xff, idx, (float)col.color[3] / (float)0xff); @@ -343,10 +344,11 @@ template static void _DescribeTEV(const MAT& mat) { for (uint32_t i = 0; i < mat.tevStageCount; ++i) { const auto& stage = mat.tevStages[i]; - fmt::print(stderr, FMT_STRING("A:{} B:{} C:{} D:{} -> {} | A:{} B:{} C:{} D:{} -> {}\n"), ToString(stage.colorInA()), - ToString(stage.colorInB()), ToString(stage.colorInC()), ToString(stage.colorInD()), - ToString(stage.colorOpOutReg()), ToString(stage.alphaInA()), ToString(stage.alphaInB()), - ToString(stage.alphaInC()), ToString(stage.alphaInD()), ToString(stage.alphaOpOutReg())); + fmt::print(stderr, FMT_STRING("A:{} B:{} C:{} D:{} -> {} | A:{} B:{} C:{} D:{} -> {}\n"), + ToString(stage.colorInA()), ToString(stage.colorInB()), ToString(stage.colorInC()), + ToString(stage.colorInD()), ToString(stage.colorOpOutReg()), ToString(stage.alphaInA()), + ToString(stage.alphaInB()), ToString(stage.alphaInC()), ToString(stage.alphaInD()), + ToString(stage.alphaOpOutReg())); } bool hasInd = mat.flags.samusReflectionIndirectTexture(); bool hasLm = mat.flags.lightmap(); @@ -459,14 +461,14 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI /* Material Flags */ out.format(FMT_STRING("new_material.retro_depth_sort = {}\n" - "new_material.retro_alpha_test = {}\n" - "new_material.retro_samus_reflection = {}\n" - "new_material.retro_depth_write = {}\n" - "new_material.retro_samus_reflection_persp = {}\n" - "new_material.retro_shadow_occluder = {}\n" - "new_material.retro_samus_reflection_indirect = {}\n" - "new_material.retro_lightmapped = {}\n" - "new_material.diffuse_color = (1, 1, 1, {})\n"), + "new_material.retro_alpha_test = {}\n" + "new_material.retro_samus_reflection = {}\n" + "new_material.retro_depth_write = {}\n" + "new_material.retro_samus_reflection_persp = {}\n" + "new_material.retro_shadow_occluder = {}\n" + "new_material.retro_samus_reflection_indirect = {}\n" + "new_material.retro_lightmapped = {}\n" + "new_material.diffuse_color = (1, 1, 1, {})\n"), material.flags.depthSorting() ? "True" : "False", material.flags.alphaTest() ? "True" : "False", material.flags.samusReflection() ? "True" : "False", material.flags.depthWrite() ? "True" : "False", material.flags.samusReflectionSurfaceEye() ? "True" : "False", @@ -763,7 +765,8 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI _GenerateRootShader(out, "RetroShader", "Emissive"_tex, "Reflection"_tex); break; case 0xF4DA0A86: /* RetroShader: KColorDiffuse, Emissive, Alpha=KAlpha */ - _GenerateRootShader(out, "RetroShader", "Diffuse"_kcol, "Emissive"_tex, "Alpha"_kcola); break; + _GenerateRootShader(out, "RetroShader", "Diffuse"_kcol, "Emissive"_tex, "Alpha"_kcola); + break; break; case 0xF559DB08: /* RetroShader: Lightmap, Diffuse, Emissive, Specular, Reflection, Alpha=1.0 */ _GenerateRootShader(out, "RetroShader", "Lightmap"_tex, "Diffuse"_tex, "Emissive"_tex, "Specular"_tex, diff --git a/DataSpec/DNAMP1/CMDLMaterials.hpp b/DataSpec/DNAMP1/CMDLMaterials.hpp index 2a1e3269f..355176df8 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.hpp +++ b/DataSpec/DNAMP1/CMDLMaterials.hpp @@ -469,9 +469,8 @@ struct MaterialSet : BigDNA { static void AddDynamicAlpha(hecl::blender::PyOutStream& out, unsigned idx); Material() = default; - Material(const hecl::blender::Material& material, - std::vector& texPathsOut, - int colorCount, bool lightmapUVs, bool matrixSkinning); + Material(const hecl::blender::Material& material, std::vector& texPathsOut, int colorCount, + bool lightmapUVs, bool matrixSkinning); }; Vector materials; @@ -617,8 +616,7 @@ struct HMDLMaterialSet : BigDNA { Vector chunks; Value blendMode = BlendMaterial::BlendMode::Opaque; - std::pair - blendFactors() const { + std::pair blendFactors() const { switch (blendMode) { case BlendMaterial::BlendMode::Opaque: default: diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index 51ebe4bfe..4b16eaaca 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -2,68 +2,68 @@ include(DNAMP1/ScriptObjects/CMakeLists.txt) include(DNAMP1/SFX/CMakeLists.txt) make_dnalist(PAK - MLVL - AGSC - CSNG - AFSM - ANCS - ANIM - CINF - CSKR - EVNT - CMDLMaterials - MREA - DeafBabe - SCAN - FRME - SAVW - HINT - MazeSeeds - SnowForces - DCLN - Tweaks/CTweakGame - Tweaks/CTweakParticle - Tweaks/CTweakPlayer - Tweaks/CTweakPlayerControl - Tweaks/CTweakPlayerGun - Tweaks/CTweakGunRes - Tweaks/CTweakPlayerRes - Tweaks/CTweakGui - Tweaks/CTweakSlideShow - Tweaks/CTweakCameraBob - Tweaks/CTweakTargeting - Tweaks/CTweakAutoMapper - Tweaks/CTweakBall - Tweaks/CTweakGuiColors) + MLVL + AGSC + CSNG + AFSM + ANCS + ANIM + CINF + CSKR + EVNT + CMDLMaterials + MREA + DeafBabe + SCAN + FRME + SAVW + HINT + MazeSeeds + SnowForces + DCLN + Tweaks/CTweakGame + Tweaks/CTweakParticle + Tweaks/CTweakPlayer + Tweaks/CTweakPlayerControl + Tweaks/CTweakPlayerGun + Tweaks/CTweakGunRes + Tweaks/CTweakPlayerRes + Tweaks/CTweakGui + Tweaks/CTweakSlideShow + Tweaks/CTweakCameraBob + Tweaks/CTweakTargeting + Tweaks/CTweakAutoMapper + Tweaks/CTweakBall + Tweaks/CTweakGuiColors) set(DNAMP1_SOURCES - DNAMP1.hpp DNAMP1.cpp - AFSM.cpp - PAK.cpp - MLVL.cpp - STRG.hpp STRG.cpp - AGSC.cpp - CSNG.cpp - CSKR.cpp - ANCS.cpp - ANIM.cpp - CINF.cpp - EVNT.cpp - PATH.hpp - CMDL.hpp CMDL.cpp - CMDLMaterials.cpp - DCLN.cpp - MAPA.hpp - MAPU.hpp - MREA.cpp - SCLY.hpp SCLY.cpp - FRME.cpp - SCAN.cpp - DeafBabe.cpp - Tweaks/CTweakAutoMapper.cpp - Tweaks/CTweakPlayer.cpp - Tweaks/CTweakTargeting.cpp - Tweaks/CTweakBall.cpp - Tweaks/CTweakGame.cpp) + DNAMP1.hpp DNAMP1.cpp + AFSM.cpp + PAK.cpp + MLVL.cpp + STRG.hpp STRG.cpp + AGSC.cpp + CSNG.cpp + CSKR.cpp + ANCS.cpp + ANIM.cpp + CINF.cpp + EVNT.cpp + PATH.hpp + CMDL.hpp CMDL.cpp + CMDLMaterials.cpp + DCLN.cpp + MAPA.hpp + MAPU.hpp + MREA.cpp + SCLY.hpp SCLY.cpp + FRME.cpp + SCAN.cpp + DeafBabe.cpp + Tweaks/CTweakAutoMapper.cpp + Tweaks/CTweakPlayer.cpp + Tweaks/CTweakTargeting.cpp + Tweaks/CTweakBall.cpp + Tweaks/CTweakGame.cpp) dataspec_add_list(DNAMP1 DNAMP1_SOURCES) diff --git a/DataSpec/DNAMP1/CSNG.cpp b/DataSpec/DNAMP1/CSNG.cpp index 9fb3f2fdc..c4e8bbf7f 100644 --- a/DataSpec/DNAMP1/CSNG.cpp +++ b/DataSpec/DNAMP1/CSNG.cpp @@ -45,7 +45,7 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) { athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr); r = std::nullopt; ydw.writeString(fmt::format(FMT_STRING("{:04X}"), head.midiSetupId), - fmt::format(FMT_STRING("../MidiData/{}"), midPath.getLastComponentUTF8())); + fmt::format(FMT_STRING("../MidiData/{}"), midPath.getLastComponentUTF8())); athena::io::FileWriter w(songsPath.getAbsolutePath()); ydw.finish(&w); diff --git a/DataSpec/DNAMP1/DCLN.cpp b/DataSpec/DNAMP1/DCLN.cpp index 383056e8a..fbbb9cd34 100644 --- a/DataSpec/DNAMP1/DCLN.cpp +++ b/DataSpec/DNAMP1/DCLN.cpp @@ -30,16 +30,15 @@ void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName) { /* Open Py Stream and read sections */ hecl::blender::PyOutStream os = conn.beginPythonOut(true); - os.format(FMT_STRING( - "import bpy\n" - "import bmesh\n" - "from mathutils import Vector, Matrix\n" - "\n" - "bpy.context.scene.name = '{}'\n" - "# Clear Scene\n" - "if len(bpy.data.collections):\n" - " bpy.data.collections.remove(bpy.data.collections[0])\n"), - entryName); + os.format(FMT_STRING("import bpy\n" + "import bmesh\n" + "from mathutils import Vector, Matrix\n" + "\n" + "bpy.context.scene.name = '{}'\n" + "# Clear Scene\n" + "if len(bpy.data.collections):\n" + " bpy.data.collections.remove(bpy.data.collections[0])\n"), + entryName); DeafBabe::BlenderInit(os); atInt32 idx = 0; diff --git a/DataSpec/DNAMP1/FRME.cpp b/DataSpec/DNAMP1/FRME.cpp index 16b83bbcc..9b2743947 100644 --- a/DataSpec/DNAMP1/FRME.cpp +++ b/DataSpec/DNAMP1/FRME.cpp @@ -306,14 +306,13 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: " bpy.context.scene.collection.objects.link(ob_new)\n" " return ob_new\n"; - os.format(FMT_STRING( - "bpy.context.scene.name = '{}'\n" - "bpy.context.scene.render.resolution_x = 640\n" - "bpy.context.scene.render.resolution_y = 480\n" - "bpy.context.scene.world.use_nodes = True\n" - "bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n" - "bg_node.inputs[1].default_value = 0.0\n"), - pakRouter.getBestEntryName(entry)); + os.format(FMT_STRING("bpy.context.scene.name = '{}'\n" + "bpy.context.scene.render.resolution_x = 640\n" + "bpy.context.scene.render.resolution_y = 480\n" + "bpy.context.scene.world.use_nodes = True\n" + "bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n" + "bg_node.inputs[1].default_value = 0.0\n"), + pakRouter.getBestEntryName(entry)); int pIdx = 0; for (const FRME::Widget& w : frme.widgets) { @@ -321,32 +320,29 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: "angle = Quaternion((1.0, 0.0, 0.0), 0)\n"; if (w.type == SBIG('CAMR')) { using CAMRInfo = Widget::CAMRInfo; - os.format(FMT_STRING( - "cam = bpy.data.cameras.new(name='{}')\n" - "binding = cam\n"), - w.header.name); + os.format(FMT_STRING("cam = bpy.data.cameras.new(name='{}')\n" + "binding = cam\n"), + w.header.name); if (CAMRInfo* info = static_cast(w.widgetInfo.get())) { if (info->projectionType == CAMRInfo::ProjectionType::Orthographic) { CAMRInfo::OrthographicProjection* proj = static_cast(info->projection.get()); - os.format(FMT_STRING( - "cam.type = 'ORTHO'\n" - "cam.ortho_scale = {}\n" - "cam.clip_start = {}\n" - "cam.clip_end = {}\n"), - std::fabs(proj->right - proj->left), proj->znear, proj->zfar); + os.format(FMT_STRING("cam.type = 'ORTHO'\n" + "cam.ortho_scale = {}\n" + "cam.clip_start = {}\n" + "cam.clip_end = {}\n"), + std::fabs(proj->right - proj->left), proj->znear, proj->zfar); } else if (info->projectionType == CAMRInfo::ProjectionType::Perspective) { CAMRInfo::PerspectiveProjection* proj = static_cast(info->projection.get()); - os.format(FMT_STRING( - "cam.type = 'PERSP'\n" - "cam.lens_unit = 'FOV'\n" - "cam.clip_start = {}\n" - "cam.clip_end = {}\n" - "bpy.context.scene.render.resolution_x = 480 * {}\n"), - proj->znear, proj->zfar, proj->aspect); + os.format(FMT_STRING("cam.type = 'PERSP'\n" + "cam.lens_unit = 'FOV'\n" + "cam.clip_start = {}\n" + "cam.clip_end = {}\n" + "bpy.context.scene.render.resolution_x = 480 * {}\n"), + proj->znear, proj->zfar, proj->aspect); if (proj->aspect > 1.f) - os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), proj->aspect, - proj->fov); + os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), + proj->aspect, proj->fov); else os.format(FMT_STRING("cam.angle = math.radians({})\n"), proj->fov); } @@ -358,10 +354,9 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: switch (info->type) { case LITEInfo::ELightType::LocalAmbient: { zeus::simd_floats colorF(w.header.color.simd); - os.format(FMT_STRING( - "bg_node.inputs[0].default_value = ({},{},{},1.0)\n" - "bg_node.inputs[1].default_value = {}\n"), - colorF[0], colorF[1], colorF[2], info->distQ / 8.0); + os.format(FMT_STRING("bg_node.inputs[0].default_value = ({},{},{},1.0)\n" + "bg_node.inputs[1].default_value = {}\n"), + colorF[0], colorF[1], colorF[2], info->distQ / 8.0); break; } case LITEInfo::ELightType::Spot: @@ -370,24 +365,22 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: [[fallthrough]]; default: { zeus::simd_floats colorF(w.header.color.simd); - os.format(FMT_STRING( - "lamp = bpy.data.lights.new(name='{}', type='POINT')\n" - "lamp.color = ({}, {}, {})\n" - "lamp.hecl_falloff_constant = {}\n" - "lamp.hecl_falloff_linear = {}\n" - "lamp.hecl_falloff_quadratic = {}\n" - "lamp.retro_light_angle_constant = {}\n" - "lamp.retro_light_angle_linear = {}\n" - "lamp.retro_light_angle_quadratic = {}\n" - "lamp.retro_light_index = {}\n" - "binding = lamp\n"), - w.header.name, colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC, - info->angL, info->angQ, info->loadedIdx); + os.format(FMT_STRING("lamp = bpy.data.lights.new(name='{}', type='POINT')\n" + "lamp.color = ({}, {}, {})\n" + "lamp.hecl_falloff_constant = {}\n" + "lamp.hecl_falloff_linear = {}\n" + "lamp.hecl_falloff_quadratic = {}\n" + "lamp.retro_light_angle_constant = {}\n" + "lamp.retro_light_angle_linear = {}\n" + "lamp.retro_light_angle_quadratic = {}\n" + "lamp.retro_light_index = {}\n" + "binding = lamp\n"), + w.header.name, colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC, + info->angL, info->angQ, info->loadedIdx); if (info->type == LITEInfo::ELightType::Spot) - os.format(FMT_STRING( - "lamp.type = 'SPOT'\n" - "lamp.spot_size = {}\n"), - info->cutoff); + os.format(FMT_STRING("lamp.type = 'SPOT'\n" + "lamp.spot_size = {}\n"), + info->cutoff); else if (info->type == LITEInfo::ELightType::Directional) os << "lamp.type = 'SUN'\n"; } @@ -413,28 +406,26 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: if (resPath.size()) { hecl::SystemUTF8Conv resPathView(resPath); - os.format(FMT_STRING( - "if '{}' in bpy.data.images:\n" - " image = bpy.data.images['{}']\n" - "else:\n" - " image = bpy.data.images.load('''//{}''')\n" - " image.name = '{}'\n"), - texName, texName, resPathView, texName); + os.format(FMT_STRING("if '{}' in bpy.data.images:\n" + " image = bpy.data.images['{}']\n" + "else:\n" + " image = bpy.data.images.load('''//{}''')\n" + " image.name = '{}'\n"), + texName, texName, resPathView, texName); } else { os << "image = None\n"; } - os.format(FMT_STRING( - "material = bpy.data.materials.new('{}')\n" - "material.use_nodes = True\n" - "new_nodetree = material.node_tree\n" - "for n in new_nodetree.nodes:\n" - " new_nodetree.nodes.remove(n)\n" - "tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n" - "tex_node.image = image\n" - "bm = bmesh.new()\n" - "verts = []\n"), - w.header.name); + os.format(FMT_STRING("material = bpy.data.materials.new('{}')\n" + "material.use_nodes = True\n" + "new_nodetree = material.node_tree\n" + "for n in new_nodetree.nodes:\n" + " new_nodetree.nodes.remove(n)\n" + "tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n" + "tex_node.image = image\n" + "bm = bmesh.new()\n" + "verts = []\n"), + w.header.name); for (uint32_t i = 0; i < info->quadCoordCount; ++i) { int ti; @@ -461,37 +452,36 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: zeus::simd_floats f(info->uvCoords[ti].simd); os.format(FMT_STRING("bm.verts[{}].link_loops[0][bm.loops.layers.uv[0]].uv = ({},{})\n"), i, f[0], f[1]); } - os.format(FMT_STRING( - "binding = bpy.data.meshes.new('{}')\n" - "bm.to_mesh(binding)\n" - "bm.free()\n" - "binding.materials.append(material)\n"), - w.header.name); + os.format(FMT_STRING("binding = bpy.data.meshes.new('{}')\n" + "bm.to_mesh(binding)\n" + "bm.free()\n" + "binding.materials.append(material)\n"), + w.header.name); } } zeus::simd_floats colorF(w.header.color.simd); - os.format(FMT_STRING( - "frme_obj = bpy.data.objects.new(name='{}', object_data=binding)\n" - "frme_obj.pass_index = {}\n" - "parentName = '{}'\n" - "frme_obj.retro_widget_type = 'RETRO_{}'\n" - "frme_obj.retro_widget_use_anim_controller = {}\n" - "frme_obj.retro_widget_default_visible = {}\n" - "frme_obj.retro_widget_default_active = {}\n" - "frme_obj.retro_widget_cull_faces = {}\n" - "frme_obj.retro_widget_color = ({},{},{},{})\n" - "frme_obj.retro_widget_model_draw_flags = bpy.types.Object.retro_widget_model_draw_flags[1]['items'][{}][0]\n" - "frme_obj.retro_widget_is_worker = {}\n" - "frme_obj.retro_widget_worker_id = {}\n" - "if parentName not in bpy.data.objects:\n" - " frme_obj.retro_widget_parent = parentName\n" - "else:\n" - " frme_obj.parent = bpy.data.objects[parentName]\n"), - w.header.name, pIdx++, w.header.parent, w.type, - w.header.useAnimController ? "True" : "False", w.header.defaultVisible ? "True" : "False", - w.header.defaultActive ? "True" : "False", w.header.cullFaces ? "True" : "False", colorF[0], colorF[1], - colorF[2], colorF[3], w.header.modelDrawFlags, w.isWorker ? "True" : "False", w.workerId); + os.format(FMT_STRING("frme_obj = bpy.data.objects.new(name='{}', object_data=binding)\n" + "frme_obj.pass_index = {}\n" + "parentName = '{}'\n" + "frme_obj.retro_widget_type = 'RETRO_{}'\n" + "frme_obj.retro_widget_use_anim_controller = {}\n" + "frme_obj.retro_widget_default_visible = {}\n" + "frme_obj.retro_widget_default_active = {}\n" + "frme_obj.retro_widget_cull_faces = {}\n" + "frme_obj.retro_widget_color = ({},{},{},{})\n" + "frme_obj.retro_widget_model_draw_flags = " + "bpy.types.Object.retro_widget_model_draw_flags[1]['items'][{}][0]\n" + "frme_obj.retro_widget_is_worker = {}\n" + "frme_obj.retro_widget_worker_id = {}\n" + "if parentName not in bpy.data.objects:\n" + " frme_obj.retro_widget_parent = parentName\n" + "else:\n" + " frme_obj.parent = bpy.data.objects[parentName]\n"), + w.header.name, pIdx++, w.header.parent, w.type, w.header.useAnimController ? "True" : "False", + w.header.defaultVisible ? "True" : "False", w.header.defaultActive ? "True" : "False", + w.header.cullFaces ? "True" : "False", colorF[0], colorF[1], colorF[2], colorF[3], + w.header.modelDrawFlags, w.isWorker ? "True" : "False", w.workerId); if (w.type == SBIG('MODL')) { using MODLInfo = FRME::Widget::MODLInfo; @@ -516,10 +506,9 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: using PANEInfo = Widget::PANEInfo; if (PANEInfo* info = static_cast(w.widgetInfo.get())) { zeus::simd_floats f(info->scaleCenter.simd); - os.format(FMT_STRING( - "frme_obj.retro_pane_dimensions = ({},{})\n" - "frme_obj.retro_pane_scale_center = ({},{},{})\n"), - info->xDim, info->zDim, f[0], f[1], f[2]); + os.format(FMT_STRING("frme_obj.retro_pane_dimensions = ({},{})\n" + "frme_obj.retro_pane_scale_center = ({},{},{})\n"), + info->xDim, info->zDim, f[0], f[1], f[2]); } } else if (w.type == SBIG('TXPN')) { using TXPNInfo = Widget::TXPNInfo; @@ -533,35 +522,33 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: zeus::simd_floats fillF(info->fillColor.simd); zeus::simd_floats outlineF(info->outlineColor.simd); zeus::simd_floats extentF(info->blockExtent.simd); - os.format(FMT_STRING( - "frme_obj.retro_pane_dimensions = ({},{})\n" - "frme_obj.retro_pane_scale_center = ({},{},{})\n" - "frme_obj.retro_textpane_font_path = '{}'\n" - "frme_obj.retro_textpane_word_wrap = {}\n" - "frme_obj.retro_textpane_horizontal = {}\n" - "frme_obj.retro_textpane_fill_color = ({},{},{},{})\n" - "frme_obj.retro_textpane_outline_color = ({},{},{},{})\n" - "frme_obj.retro_textpane_block_extent = ({},{})\n" - "frme_obj.retro_textpane_jp_font_path = '{}'\n" - "frme_obj.retro_textpane_jp_font_scale = ({},{})\n" - "frme_obj.retro_textpane_hjustification = " - "bpy.types.Object.retro_textpane_hjustification[1]['items'][{}][0]\n" - "frme_obj.retro_textpane_vjustification = " - "bpy.types.Object.retro_textpane_vjustification[1]['items'][{}][0]\n"), - info->xDim, info->zDim, scaleF[0], scaleF[1], scaleF[2], fontPath.getRelativePathUTF8(), - info->wordWrap ? "True" : "False", info->horizontal ? "True" : "False", fillF[0], fillF[1], fillF[2], - fillF[3], outlineF[0], outlineF[1], outlineF[2], outlineF[3], extentF[0], extentF[1], - jpFontPath.getRelativePathUTF8(), info->jpnPointScale[0], info->jpnPointScale[1], - int(info->justification), int(info->verticalJustification)); + os.format(FMT_STRING("frme_obj.retro_pane_dimensions = ({},{})\n" + "frme_obj.retro_pane_scale_center = ({},{},{})\n" + "frme_obj.retro_textpane_font_path = '{}'\n" + "frme_obj.retro_textpane_word_wrap = {}\n" + "frme_obj.retro_textpane_horizontal = {}\n" + "frme_obj.retro_textpane_fill_color = ({},{},{},{})\n" + "frme_obj.retro_textpane_outline_color = ({},{},{},{})\n" + "frme_obj.retro_textpane_block_extent = ({},{})\n" + "frme_obj.retro_textpane_jp_font_path = '{}'\n" + "frme_obj.retro_textpane_jp_font_scale = ({},{})\n" + "frme_obj.retro_textpane_hjustification = " + "bpy.types.Object.retro_textpane_hjustification[1]['items'][{}][0]\n" + "frme_obj.retro_textpane_vjustification = " + "bpy.types.Object.retro_textpane_vjustification[1]['items'][{}][0]\n"), + info->xDim, info->zDim, scaleF[0], scaleF[1], scaleF[2], fontPath.getRelativePathUTF8(), + info->wordWrap ? "True" : "False", info->horizontal ? "True" : "False", fillF[0], fillF[1], fillF[2], + fillF[3], outlineF[0], outlineF[1], outlineF[2], outlineF[3], extentF[0], extentF[1], + jpFontPath.getRelativePathUTF8(), info->jpnPointScale[0], info->jpnPointScale[1], + int(info->justification), int(info->verticalJustification)); } } else if (w.type == SBIG('TBGP')) { using TBGPInfo = Widget::TBGPInfo; if (TBGPInfo* info = static_cast(w.widgetInfo.get())) { - os.format(FMT_STRING( - "frme_obj.retro_tablegroup_elem_count = {}\n" - "frme_obj.retro_tablegroup_elem_default = {}\n" - "frme_obj.retro_tablegroup_wraparound = {}\n"), - info->elementCount, info->defaultSelection, info->selectWraparound ? "True" : "False"); + os.format(FMT_STRING("frme_obj.retro_tablegroup_elem_count = {}\n" + "frme_obj.retro_tablegroup_elem_default = {}\n" + "frme_obj.retro_tablegroup_wraparound = {}\n"), + info->elementCount, info->defaultSelection, info->selectWraparound ? "True" : "False"); } } else if (w.type == SBIG('GRUP')) { using GRUPInfo = Widget::GRUPInfo; @@ -571,12 +558,11 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: } else if (w.type == SBIG('SLGP')) { using SLGPInfo = Widget::SLGPInfo; if (SLGPInfo* info = static_cast(w.widgetInfo.get())) { - os.format(FMT_STRING( - "frme_obj.retro_slider_min = {}\n" - "frme_obj.retro_slider_max = {}\n" - "frme_obj.retro_slider_default = {}\n" - "frme_obj.retro_slider_increment = {}\n"), - info->min, info->max, info->cur, info->increment); + os.format(FMT_STRING("frme_obj.retro_slider_min = {}\n" + "frme_obj.retro_slider_max = {}\n" + "frme_obj.retro_slider_default = {}\n" + "frme_obj.retro_slider_increment = {}\n"), + info->min, info->max, info->cur, info->increment); } } else if (w.type == SBIG('ENRG')) { using ENRGInfo = Widget::ENRGInfo; @@ -588,11 +574,10 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: } else if (w.type == SBIG('METR')) { using METRInfo = Widget::METRInfo; if (METRInfo* info = static_cast(w.widgetInfo.get())) { - os.format(FMT_STRING( - "frme_obj.retro_meter_no_round_up = {}\n" - "frme_obj.retro_meter_max_capacity = {}\n" - "frme_obj.retro_meter_worker_count = {}\n"), - info->noRoundUp ? "True" : "False", info->maxCapacity, info->workerCount); + os.format(FMT_STRING("frme_obj.retro_meter_no_round_up = {}\n" + "frme_obj.retro_meter_max_capacity = {}\n" + "frme_obj.retro_meter_worker_count = {}\n"), + info->noRoundUp ? "True" : "False", info->maxCapacity, info->workerCount); } } @@ -600,16 +585,15 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: for (int i = 0; i < 3; ++i) w.basis[i].simd.copy_to(xfMtxF[i]); zeus::simd_floats originF(w.origin.simd); - os.format(FMT_STRING( - "mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n" - "mtxd = mtx.decompose()\n" - "frme_obj.rotation_mode = 'QUATERNION'\n" - "frme_obj.location = mtxd[0]\n" - "frme_obj.rotation_quaternion = mtxd[1] @ angle\n" - "frme_obj.scale = mtxd[2]\n" - "bpy.context.scene.collection.objects.link(frme_obj)\n"), - xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], originF[0], xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], originF[1], - xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], originF[2]); + os.format(FMT_STRING("mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n" + "mtxd = mtx.decompose()\n" + "frme_obj.rotation_mode = 'QUATERNION'\n" + "frme_obj.location = mtxd[0]\n" + "frme_obj.rotation_quaternion = mtxd[1] @ angle\n" + "frme_obj.scale = mtxd[2]\n" + "bpy.context.scene.collection.objects.link(frme_obj)\n"), + xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], originF[0], xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], + originF[1], xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], originF[2]); } os.centerView(); diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index bcb59eb5b..7c6ae49a4 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -202,8 +202,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: "from mathutils import Vector\n" "bpy.context.scene.render.fps = 60\n" "\n"; - os.format(FMT_STRING("bpy.context.scene.name = '{}'\n"), - pakRouter.getBestEntryName(entry, false)); + os.format(FMT_STRING("bpy.context.scene.name = '{}'\n"), pakRouter.getBestEntryName(entry, false)); DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath()); MaterialSet::RegisterMaterialProps(os); os << "# Clear Scene\n" @@ -244,13 +243,13 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin); curSec += DNACMDL::ReadGeomSectionsToBlender, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1>( os, rs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]); - os.format(FMT_STRING( - "obj.retro_disable_enviro_visor = {}\n" - "obj.retro_disable_thermal_visor = {}\n" - "obj.retro_disable_xray_visor = {}\n" - "obj.retro_thermal_level = '{}'\n"), - mHeader.visorFlags.disableEnviro() ? "True" : "False", mHeader.visorFlags.disableThermal() ? "True" : "False", - mHeader.visorFlags.disableXray() ? "True" : "False", mHeader.visorFlags.thermalLevelStr()); + os.format(FMT_STRING("obj.retro_disable_enviro_visor = {}\n" + "obj.retro_disable_thermal_visor = {}\n" + "obj.retro_disable_xray_visor = {}\n" + "obj.retro_thermal_level = '{}'\n"), + mHeader.visorFlags.disableEnviro() ? "True" : "False", + mHeader.visorFlags.disableThermal() ? "True" : "False", + mHeader.visorFlags.disableXray() ? "True" : "False", mHeader.visorFlags.thermalLevelStr()); } /* Skip AROT */ @@ -314,8 +313,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: "bpy.context.view_layer.layer_collection.children['Collision'].hide_viewport = True\n"; /* Link MLVL scene as background */ - os.linkBackground(fmt::format(FMT_STRING("//../!world_{}.blend"), - pakRouter.getCurrentBridge().getLevelId()), "World"sv); + os.linkBackground(fmt::format(FMT_STRING("//../!world_{}.blend"), pakRouter.getCurrentBridge().getLevelId()), + "World"sv); os.centerView(); os.close(); diff --git a/DataSpec/DNAMP1/SCLY.cpp b/DataSpec/DNAMP1/SCLY.cpp index d356a2d17..81e6f3438 100644 --- a/DataSpec/DNAMP1/SCLY.cpp +++ b/DataSpec/DNAMP1/SCLY.cpp @@ -114,13 +114,15 @@ void SCLY::ScriptLayer::Enumerate(athena::io::IStreamReader& rs) { objects.push_back(std::move(obj)); size_t actualLen = rs.position() - start; if (actualLen != len) - Log.report(logvisor::Fatal, - FMT_STRING(_SYS_STR("Error while reading object of type 0x{:02X}, did not read the expected amount of " + Log.report( + logvisor::Fatal, + FMT_STRING(_SYS_STR("Error while reading object of type 0x{:02X}, did not read the expected amount of " "data, read 0x{:x}, expected 0x{:x}")), - (atUint32)type, actualLen, len); + (atUint32)type, actualLen, len); rs.seek(start + len, athena::SeekOrigin::Begin); } else { - Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type); + Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find type 0x{:X} in object database")), + (atUint32)type); } } } @@ -145,7 +147,8 @@ void SCLY::ScriptLayer::Enumerate(athena::io::YAMLDocReader& r obj->type = type; objects.push_back(std::move(obj)); } else - Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type); + Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find type 0x{:X} in object database")), + (atUint32)type); } } } else diff --git a/DataSpec/DNAMP1/SFX/Atomic.h b/DataSpec/DNAMP1/SFX/Atomic.h index 24924ce77..3a9e479c1 100644 --- a/DataSpec/DNAMP1/SFX/Atomic.h +++ b/DataSpec/DNAMP1/SFX/Atomic.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0001 1 - #define SFXelu_a_elec_lp_00 42 #define SFXat2_b_fly_lp_00 43 #define SFXatm_b_fly_lp_00 44 @@ -27,5 +25,3 @@ #define SFXsfx0039 57 #define SFXsfx003A 58 #define SFXsfx003B 59 - - diff --git a/DataSpec/DNAMP1/SFX/BetaBeetle.h b/DataSpec/DNAMP1/SFX/BetaBeetle.h index 7f4a3a5ff..e4d1b8c94 100644 --- a/DataSpec/DNAMP1/SFX/BetaBeetle.h +++ b/DataSpec/DNAMP1/SFX/BetaBeetle.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0002 2 - #define SFXsfx003C 60 #define SFXsfx003D 61 #define SFXsfx003E 62 @@ -41,5 +39,3 @@ #define SFXsfx0059 89 #define SFXsfx005A 90 #define SFXsfx005B 91 - - diff --git a/DataSpec/DNAMP1/SFX/Bird.h b/DataSpec/DNAMP1/SFX/Bird.h index ecc140ffa..2063eb151 100644 --- a/DataSpec/DNAMP1/SFX/Bird.h +++ b/DataSpec/DNAMP1/SFX/Bird.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0003 3 - #define SFXsfx005C 92 #define SFXsfx005D 93 #define SFXsfx005E 94 @@ -16,5 +14,3 @@ #define SFXsfx0060 96 #define SFXsfx0061 97 #define SFXsfx0062 98 - - diff --git a/DataSpec/DNAMP1/SFX/BloodFlower.h b/DataSpec/DNAMP1/SFX/BloodFlower.h index ddb50da2b..810f8529a 100644 --- a/DataSpec/DNAMP1/SFX/BloodFlower.h +++ b/DataSpec/DNAMP1/SFX/BloodFlower.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0004 4 - #define SFXblf_a_btmspit_00 99 #define SFXblf_a_bulb_00 100 #define SFXsfx0065 101 @@ -30,5 +28,3 @@ #define SFXsfx0075 117 #define SFXsfx0076 118 #define SFXsfx0077 119 - - diff --git a/DataSpec/DNAMP1/SFX/Burrower.h b/DataSpec/DNAMP1/SFX/Burrower.h index e9719e4fe..a50e410d7 100644 --- a/DataSpec/DNAMP1/SFX/Burrower.h +++ b/DataSpec/DNAMP1/SFX/Burrower.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0005 5 - #define SFXbur_a_attack_00 120 #define SFXbur_b_burrow_lp_00 121 #define SFXbur_b_idle_00 122 @@ -29,5 +27,3 @@ #define SFXsfx0089 137 #define SFXsfx008A 138 #define SFXsfx008B 139 - - diff --git a/DataSpec/DNAMP1/SFX/CMakeLists.txt b/DataSpec/DNAMP1/SFX/CMakeLists.txt index a6cb903f4..c0de54e48 100644 --- a/DataSpec/DNAMP1/SFX/CMakeLists.txt +++ b/DataSpec/DNAMP1/SFX/CMakeLists.txt @@ -1,7 +1,7 @@ unset(DNAMP1_SFX_SOURCES) macro(add_sfx_header HEADER SYMBOL) - bintoc("DNAMP1/SFX/${SYMBOL}.cpp" "DNAMP1/SFX/${HEADER}" "${SYMBOL}") - list(APPEND DNAMP1_SFX_SOURCES "DNAMP1/SFX/${SYMBOL}.cpp" "DNAMP1/SFX/${HEADER}") + bintoc("DNAMP1/SFX/${SYMBOL}.cpp" "DNAMP1/SFX/${HEADER}" "${SYMBOL}") + list(APPEND DNAMP1_SFX_SOURCES "DNAMP1/SFX/${SYMBOL}.cpp" "DNAMP1/SFX/${HEADER}") endmacro(add_sfx_header) add_sfx_header(Atomic.h Atomic_H) diff --git a/DataSpec/DNAMP1/SFX/ChozoGhost.h b/DataSpec/DNAMP1/SFX/ChozoGhost.h index 54c1f93c2..db4c64496 100644 --- a/DataSpec/DNAMP1/SFX/ChozoGhost.h +++ b/DataSpec/DNAMP1/SFX/ChozoGhost.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0006 6 - #define SFXchg_a_dball_00 140 #define SFXchg_a_dcharge_00 141 #define SFXchg_a_dfire_00 142 @@ -61,5 +59,3 @@ #define SFXsfx00BD 189 #define SFXsfx00BE 190 #define SFXsfx00BF 191 - - diff --git a/DataSpec/DNAMP1/SFX/ChubbWeed.h b/DataSpec/DNAMP1/SFX/ChubbWeed.h index 11a943595..335282aa6 100644 --- a/DataSpec/DNAMP1/SFX/ChubbWeed.h +++ b/DataSpec/DNAMP1/SFX/ChubbWeed.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0007 7 - #define SFXchb_r_scream_00 192 #define SFXchb_r_alert_00_lp 193 #define SFXsfx00C2 194 @@ -16,5 +14,3 @@ #define SFXsfx00C4 196 #define SFXsfx00C5 197 #define SFXsfx00C6 198 - - diff --git a/DataSpec/DNAMP1/SFX/CineBoots.h b/DataSpec/DNAMP1/SFX/CineBoots.h index 25f9aaef9..de308fe57 100644 --- a/DataSpec/DNAMP1/SFX/CineBoots.h +++ b/DataSpec/DNAMP1/SFX/CineBoots.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup003B 59 - #define SFXci7_x_jump_00 2972 #define SFXsja_c_electric_lp_00 2973 #define SFXsfx0B9E 2974 @@ -29,5 +27,3 @@ #define SFXsfx0BAD 2989 #define SFXsfx0BAE 2990 #define SFXsfx0BAF 2991 - - diff --git a/DataSpec/DNAMP1/SFX/CineGeneral.h b/DataSpec/DNAMP1/SFX/CineGeneral.h index 832cd4eac..a0b6f354e 100644 --- a/DataSpec/DNAMP1/SFX/CineGeneral.h +++ b/DataSpec/DNAMP1/SFX/CineGeneral.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup003C 60 - #define SFXsfx0BB0 2992 #define SFXsfx0BB1 2993 #define SFXci5_x_mapdown_00 2994 @@ -50,5 +48,3 @@ #define SFXsfx0BD6 3030 #define SFXsfx0BD7 3031 #define SFXsfx0BD8 3032 - - diff --git a/DataSpec/DNAMP1/SFX/CineGun.h b/DataSpec/DNAMP1/SFX/CineGun.h index 7535d08b9..b9632024c 100644 --- a/DataSpec/DNAMP1/SFX/CineGun.h +++ b/DataSpec/DNAMP1/SFX/CineGun.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup003E 62 - #define SFXsfx0BE5 3045 #define SFXci3_x_clank_00 3046 #define SFXci4_x_clank_00 3047 @@ -23,5 +21,3 @@ #define SFXsfx0BF0 3056 #define SFXsfx0BF1 3057 #define SFXsfx0BF2 3058 - - diff --git a/DataSpec/DNAMP1/SFX/CineMorphball.h b/DataSpec/DNAMP1/SFX/CineMorphball.h index 58ab4a907..024beb655 100644 --- a/DataSpec/DNAMP1/SFX/CineMorphball.h +++ b/DataSpec/DNAMP1/SFX/CineMorphball.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup003F 63 - #define SFXsfx0BF3 3059 #define SFXsfx0BF4 3060 #define SFXsfx0BF5 3061 @@ -19,5 +17,3 @@ #define SFXsfx0BFA 3066 #define SFXsfx0BFB 3067 #define SFXsfx0BFC 3068 - - diff --git a/DataSpec/DNAMP1/SFX/CineSuit.h b/DataSpec/DNAMP1/SFX/CineSuit.h index a119ce5f3..51f50847a 100644 --- a/DataSpec/DNAMP1/SFX/CineSuit.h +++ b/DataSpec/DNAMP1/SFX/CineSuit.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0040 64 - #define SFXci2_x_energy_lp_00 3069 #define SFXci2_x_energy_lp_01 3070 #define SFXsfx0BFF 3071 @@ -34,5 +32,3 @@ #define SFXsfx0C13 3091 #define SFXsfx0C14 3092 #define SFXsfx0C15 3093 - - diff --git a/DataSpec/DNAMP1/SFX/CineVisor.h b/DataSpec/DNAMP1/SFX/CineVisor.h index 7a8ed6b5b..2ba884901 100644 --- a/DataSpec/DNAMP1/SFX/CineVisor.h +++ b/DataSpec/DNAMP1/SFX/CineVisor.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup003D 61 - #define SFXcin_x_visor_00 3033 #define SFXsfx0BDA 3034 #define SFXsfx0BDB 3035 @@ -21,5 +19,3 @@ #define SFXsfx0BE2 3042 #define SFXsfx0BE3 3043 #define SFXsfx0BE4 3044 - - diff --git a/DataSpec/DNAMP1/SFX/Crater.h b/DataSpec/DNAMP1/SFX/Crater.h index 995d6c104..619503d93 100644 --- a/DataSpec/DNAMP1/SFX/Crater.h +++ b/DataSpec/DNAMP1/SFX/Crater.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup002C 44 - #define SFXsfx0764 1892 #define SFXsfx0765 1893 #define SFXsfx0766 1894 @@ -39,5 +37,3 @@ #define SFXsfx077F 1919 #define SFXsfx0780 1920 #define SFXsfx0781 1921 - - diff --git a/DataSpec/DNAMP1/SFX/Crystallite.h b/DataSpec/DNAMP1/SFX/Crystallite.h index 2fd9ff9af..527c51a38 100644 --- a/DataSpec/DNAMP1/SFX/Crystallite.h +++ b/DataSpec/DNAMP1/SFX/Crystallite.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0008 8 - #define SFXcry_b_idle_00 199 #define SFXsfx00C8 200 #define SFXsfx00C9 201 @@ -19,5 +17,3 @@ #define SFXsfx00CE 206 #define SFXsfx00CF 207 #define SFXsfx00D0 208 - - diff --git a/DataSpec/DNAMP1/SFX/Drones.h b/DataSpec/DNAMP1/SFX/Drones.h index e23b56fde..5a19c7dd3 100644 --- a/DataSpec/DNAMP1/SFX/Drones.h +++ b/DataSpec/DNAMP1/SFX/Drones.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0009 9 - #define SFXepr_a_shockhit_00 209 #define SFXsfx00D2 210 #define SFXdrn_b_burst_00 211 @@ -69,5 +67,3 @@ #define SFXsfx010A 266 #define SFXsfx010B 267 #define SFXsfx010C 268 - - diff --git a/DataSpec/DNAMP1/SFX/EliteSpacePirate.h b/DataSpec/DNAMP1/SFX/EliteSpacePirate.h index 76d878d5e..f74531c5e 100644 --- a/DataSpec/DNAMP1/SFX/EliteSpacePirate.h +++ b/DataSpec/DNAMP1/SFX/EliteSpacePirate.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup000A 10 - #define SFXepr_a_grenade_00 269 #define SFXsfx010E 270 #define SFXsfx010F 271 @@ -63,5 +61,3 @@ #define SFXsfx0140 320 #define SFXsfx0141 321 #define SFXsfx0142 322 - - diff --git a/DataSpec/DNAMP1/SFX/FireFlea.h b/DataSpec/DNAMP1/SFX/FireFlea.h index 16e3737ac..4df323504 100644 --- a/DataSpec/DNAMP1/SFX/FireFlea.h +++ b/DataSpec/DNAMP1/SFX/FireFlea.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup000B 11 - #define SFXfif_b_idle_lp_00 323 #define SFXsfx0144 324 #define SFXfif_b_light_00 325 @@ -22,5 +20,3 @@ #define SFXsfx014D 333 #define SFXsfx014E 334 #define SFXsfx014F 335 - - diff --git a/DataSpec/DNAMP1/SFX/Flaaghra.h b/DataSpec/DNAMP1/SFX/Flaaghra.h index 4607e0f88..57c3ba17d 100644 --- a/DataSpec/DNAMP1/SFX/Flaaghra.h +++ b/DataSpec/DNAMP1/SFX/Flaaghra.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0034 52 - #define SFXfla_a_hitgrnd_00 2600 #define SFXfla_a_swoosh_00 2601 #define SFXfla_a_swoosh_01 2602 @@ -90,5 +88,3 @@ #define SFXsfx0A76 2678 #define SFXsfx0A77 2679 #define SFXsfx0A78 2680 - - diff --git a/DataSpec/DNAMP1/SFX/FlickerBat.h b/DataSpec/DNAMP1/SFX/FlickerBat.h index ba498cc7b..dd188bb8d 100644 --- a/DataSpec/DNAMP1/SFX/FlickerBat.h +++ b/DataSpec/DNAMP1/SFX/FlickerBat.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup000C 12 - #define SFXflk_b_flicker_00 336 #define SFXflk_b_talk_00 337 #define SFXflk_b_talk_01 338 @@ -21,5 +19,3 @@ #define SFXsfx0159 345 #define SFXsfx015A 346 #define SFXsfx015B 347 - - diff --git a/DataSpec/DNAMP1/SFX/FlyingPirate.h b/DataSpec/DNAMP1/SFX/FlyingPirate.h index 9856b52a3..f113554e8 100644 --- a/DataSpec/DNAMP1/SFX/FlyingPirate.h +++ b/DataSpec/DNAMP1/SFX/FlyingPirate.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup000D 13 - #define SFXsfx015C 348 #define SFXfpr_a_chaff_00 349 #define SFXsfx015E 350 @@ -68,5 +66,3 @@ #define SFXsfx0194 404 #define SFXsfx0195 405 #define SFXsfx0196 406 - - diff --git a/DataSpec/DNAMP1/SFX/FrontEnd.h b/DataSpec/DNAMP1/SFX/FrontEnd.h index 99c424c10..72089e3f8 100644 --- a/DataSpec/DNAMP1/SFX/FrontEnd.h +++ b/DataSpec/DNAMP1/SFX/FrontEnd.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0026 38 - #define SFXfnt_transfore_00L 1090 #define SFXfnt_advance_R 1091 #define SFXsfx0444 1092 @@ -47,5 +45,3 @@ #define SFXsfx0465 1125 #define SFXsfx0466 1126 #define SFXsfx0467 1127 - - diff --git a/DataSpec/DNAMP1/SFX/GagantuanBeatle.h b/DataSpec/DNAMP1/SFX/GagantuanBeatle.h index b501decdc..3a5144609 100644 --- a/DataSpec/DNAMP1/SFX/GagantuanBeatle.h +++ b/DataSpec/DNAMP1/SFX/GagantuanBeatle.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup000E 14 - #define SFXgab_r_hitlight_01 407 #define SFXga2_b_digexplod_00 408 #define SFXga2_b_digscream_00 409 @@ -61,5 +59,3 @@ #define SFXsfx01C8 456 #define SFXsfx01C9 457 #define SFXsfx01CA 458 - - diff --git a/DataSpec/DNAMP1/SFX/Gnats.h b/DataSpec/DNAMP1/SFX/Gnats.h index ec6c6a258..dbe29e524 100644 --- a/DataSpec/DNAMP1/SFX/Gnats.h +++ b/DataSpec/DNAMP1/SFX/Gnats.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup000F 15 - #define SFXsfx01CB 459 #define SFXsfx01CC 460 #define SFXsfx01CD 461 @@ -16,5 +14,3 @@ #define SFXsfx01CF 463 #define SFXsfx01D0 464 #define SFXsfx01D1 465 - - diff --git a/DataSpec/DNAMP1/SFX/Gryzbee.h b/DataSpec/DNAMP1/SFX/Gryzbee.h index 664aa1c18..fa242ad01 100644 --- a/DataSpec/DNAMP1/SFX/Gryzbee.h +++ b/DataSpec/DNAMP1/SFX/Gryzbee.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0010 16 - #define SFXgrz_b_idle_00 466 #define SFXsfx01D3 467 #define SFXsfx01D4 468 @@ -21,5 +19,3 @@ #define SFXsfx01DB 475 #define SFXsfx01DC 476 #define SFXsfx01DD 477 - - diff --git a/DataSpec/DNAMP1/SFX/IceCrack.h b/DataSpec/DNAMP1/SFX/IceCrack.h index fe4a5129e..a5649ef49 100644 --- a/DataSpec/DNAMP1/SFX/IceCrack.h +++ b/DataSpec/DNAMP1/SFX/IceCrack.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0043 67 - #define SFXsfx0C31 3121 #define SFXsfx0C32 3122 #define SFXsfx0C33 3123 @@ -29,5 +27,3 @@ #define SFXsfx0C42 3138 #define SFXsfx0C43 3139 #define SFXsfx0C44 3140 - - diff --git a/DataSpec/DNAMP1/SFX/IceWorld.h b/DataSpec/DNAMP1/SFX/IceWorld.h index 6bf538ffb..a4a6848d8 100644 --- a/DataSpec/DNAMP1/SFX/IceWorld.h +++ b/DataSpec/DNAMP1/SFX/IceWorld.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup002D 45 - #define SFXice_x_gateopen_lp_00 1922 #define SFXice_x_gatestop_00 1923 #define SFXsfx0784 1924 @@ -129,5 +127,3 @@ #define SFXsfx07F7 2039 #define SFXsfx07F8 2040 #define SFXsfx07F9 2041 - - diff --git a/DataSpec/DNAMP1/SFX/InjuredPirates.h b/DataSpec/DNAMP1/SFX/InjuredPirates.h index 76c15d97c..ccae4b78c 100644 --- a/DataSpec/DNAMP1/SFX/InjuredPirates.h +++ b/DataSpec/DNAMP1/SFX/InjuredPirates.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0011 17 - #define SFXsfx01DE 478 #define SFXsfx01DF 479 #define SFXspr_b_exhale_00 480 @@ -39,5 +37,3 @@ #define SFXsfx01F9 505 #define SFXsfx01FA 506 #define SFXsfx01FB 507 - - diff --git a/DataSpec/DNAMP1/SFX/IntroBoss.h b/DataSpec/DNAMP1/SFX/IntroBoss.h index d167c7a00..038021873 100644 --- a/DataSpec/DNAMP1/SFX/IntroBoss.h +++ b/DataSpec/DNAMP1/SFX/IntroBoss.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0000 0 - #define SFXsfx0000 0 #define SFXsfx0001 1 #define SFXsfx0002 2 @@ -51,5 +49,3 @@ #define SFXsfx0027 39 #define SFXsfx0028 40 #define SFXsfx0029 41 - - diff --git a/DataSpec/DNAMP1/SFX/IntroWorld.h b/DataSpec/DNAMP1/SFX/IntroWorld.h index 0f0884e72..a1c83f321 100644 --- a/DataSpec/DNAMP1/SFX/IntroWorld.h +++ b/DataSpec/DNAMP1/SFX/IntroWorld.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup002E 46 - #define SFXsfx07FA 2042 #define SFXsfx07FB 2043 #define SFXsfx07FC 2044 @@ -148,5 +146,3 @@ #define SFXsfx0882 2178 #define SFXsfx0883 2179 #define SFXsfx0884 2180 - - diff --git a/DataSpec/DNAMP1/SFX/JellyZap.h b/DataSpec/DNAMP1/SFX/JellyZap.h index 0a417f082..77d4fd513 100644 --- a/DataSpec/DNAMP1/SFX/JellyZap.h +++ b/DataSpec/DNAMP1/SFX/JellyZap.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0012 18 - #define SFXjzp_a_shock_00 508 #define SFXjzp_a_suck_lp_00 509 #define SFXjzp_b_bubbles_00 510 @@ -19,5 +17,3 @@ #define SFXsfx0203 515 #define SFXsfx0204 516 #define SFXsfx0205 517 - - diff --git a/DataSpec/DNAMP1/SFX/LavaWorld.h b/DataSpec/DNAMP1/SFX/LavaWorld.h index 16d3394fd..0282d97eb 100644 --- a/DataSpec/DNAMP1/SFX/LavaWorld.h +++ b/DataSpec/DNAMP1/SFX/LavaWorld.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup002F 47 - #define SFXsfx0885 2181 #define SFXsfx0886 2182 #define SFXlav_wlklava_00 2183 @@ -112,5 +110,3 @@ #define SFXsfx08E9 2281 #define SFXsfx08EA 2282 #define SFXsfx08EB 2283 - - diff --git a/DataSpec/DNAMP1/SFX/Magdolite.h b/DataSpec/DNAMP1/SFX/Magdolite.h index 6be8459f0..ccdf76583 100644 --- a/DataSpec/DNAMP1/SFX/Magdolite.h +++ b/DataSpec/DNAMP1/SFX/Magdolite.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0013 19 - #define SFXmag_b_alert_00 518 #define SFXmag_b_idle_00 519 #define SFXsfx0208 520 @@ -39,5 +37,3 @@ #define SFXsfx0221 545 #define SFXsfx0222 546 #define SFXsfx0223 547 - - diff --git a/DataSpec/DNAMP1/SFX/Metaree.h b/DataSpec/DNAMP1/SFX/Metaree.h index f086fda7e..1b43bcc8f 100644 --- a/DataSpec/DNAMP1/SFX/Metaree.h +++ b/DataSpec/DNAMP1/SFX/Metaree.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0014 20 - #define SFXmtr_a_scream_00 548 #define SFXsfx0225 549 #define SFXmtr_b_spin_lp_06 550 @@ -20,5 +18,3 @@ #define SFXsfx022C 556 #define SFXsfx022D 557 #define SFXsfx022E 558 - - diff --git a/DataSpec/DNAMP1/SFX/Metroid.h b/DataSpec/DNAMP1/SFX/Metroid.h index f37d066a8..994d2de00 100644 --- a/DataSpec/DNAMP1/SFX/Metroid.h +++ b/DataSpec/DNAMP1/SFX/Metroid.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0015 21 - #define SFXsfx022F 559 #define SFXsfx0230 560 #define SFXmtd_a_facehug_02 561 @@ -74,5 +72,3 @@ #define SFXsfx026D 621 #define SFXsfx026E 622 #define SFXsfx026F 623 - - diff --git a/DataSpec/DNAMP1/SFX/MetroidPrime.h b/DataSpec/DNAMP1/SFX/MetroidPrime.h index f16443259..556fb1803 100644 --- a/DataSpec/DNAMP1/SFX/MetroidPrime.h +++ b/DataSpec/DNAMP1/SFX/MetroidPrime.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup003A 58 - #define SFXmtb_b_voxtaunt_00 2891 #define SFXsfx0B4C 2892 #define SFXmtb_a_claw_00 2893 @@ -90,5 +88,3 @@ #define SFXmtb_a_nrgfire_lp_00 2969 #define SFXsfx0B9A 2970 #define SFXsfx0B9B 2971 - - diff --git a/DataSpec/DNAMP1/SFX/MinesWorld.h b/DataSpec/DNAMP1/SFX/MinesWorld.h index 3c19f6bd8..266d04a32 100644 --- a/DataSpec/DNAMP1/SFX/MinesWorld.h +++ b/DataSpec/DNAMP1/SFX/MinesWorld.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0030 48 - #define SFXsfx08EC 2284 #define SFXsfx08ED 2285 #define SFXsfx08EE 2286 @@ -90,5 +88,3 @@ #define SFXsfx093A 2362 #define SFXsfx093B 2363 #define SFXsfx093C 2364 - - diff --git a/DataSpec/DNAMP1/SFX/Misc.h b/DataSpec/DNAMP1/SFX/Misc.h index 67c59bdfb..f2fd5a3f6 100644 --- a/DataSpec/DNAMP1/SFX/Misc.h +++ b/DataSpec/DNAMP1/SFX/Misc.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPmisc 39 - #define SFXdor_x_close_00 1128 #define SFXdor_x_open_00 1129 #define SFXsfx046A 1130 @@ -256,5 +254,3 @@ #define SFXsfx055C 1372 #define SFXsfx055D 1373 #define SFXsfx055E 1374 - - diff --git a/DataSpec/DNAMP1/SFX/MiscSamus.h b/DataSpec/DNAMP1/SFX/MiscSamus.h index 5ec47e9ec..48c048fb1 100644 --- a/DataSpec/DNAMP1/SFX/MiscSamus.h +++ b/DataSpec/DNAMP1/SFX/MiscSamus.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPmiscSamus 41 - #define SFXsam_wlkstone_00 1465 #define SFXsam_wlkstone_01 1466 #define SFXsam_suit_damage 1467 @@ -268,5 +266,3 @@ #define SFXsfx06B9 1721 #define SFXsfx06BA 1722 #define SFXsfx06BB 1723 - - diff --git a/DataSpec/DNAMP1/SFX/OmegaPirate.h b/DataSpec/DNAMP1/SFX/OmegaPirate.h index ec5f018d1..fa9a52fdb 100644 --- a/DataSpec/DNAMP1/SFX/OmegaPirate.h +++ b/DataSpec/DNAMP1/SFX/OmegaPirate.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0039 57 - #define SFXsfx0B0F 2831 #define SFXsfx0B10 2832 #define SFXopr_b_voxcall_00 2833 @@ -69,5 +67,3 @@ #define SFXsfx0B48 2888 #define SFXsfx0B49 2889 #define SFXsfx0B4A 2890 - - diff --git a/DataSpec/DNAMP1/SFX/OverWorld.h b/DataSpec/DNAMP1/SFX/OverWorld.h index dd2ba94bd..ad6f1ce22 100644 --- a/DataSpec/DNAMP1/SFX/OverWorld.h +++ b/DataSpec/DNAMP1/SFX/OverWorld.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0033 51 - #define SFXsfx09E0 2528 #define SFXsfx09E1 2529 #define SFXsfx09E2 2530 @@ -81,5 +79,3 @@ #define SFXsfx0A25 2597 #define SFXsfx0A26 2598 #define SFXsfx0A27 2599 - - diff --git a/DataSpec/DNAMP1/SFX/Parasite.h b/DataSpec/DNAMP1/SFX/Parasite.h index 73187bdc1..9cb43c4c9 100644 --- a/DataSpec/DNAMP1/SFX/Parasite.h +++ b/DataSpec/DNAMP1/SFX/Parasite.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0016 22 - #define SFXpar_a_voxangry_00 624 #define SFXsfx0271 625 #define SFXsfx0272 626 @@ -33,5 +31,3 @@ #define SFXsfx0285 645 #define SFXsfx0286 646 #define SFXsfx0287 647 - - diff --git a/DataSpec/DNAMP1/SFX/Phazon.h b/DataSpec/DNAMP1/SFX/Phazon.h index 5ef08f9d4..1960e880d 100644 --- a/DataSpec/DNAMP1/SFX/Phazon.h +++ b/DataSpec/DNAMP1/SFX/Phazon.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0042 66 - #define SFXphz_damage_lp 3114 #define SFXsfx0C2B 3115 #define SFXsfx0C2C 3116 @@ -16,5 +14,3 @@ #define SFXsfx0C2E 3118 #define SFXsfx0C2F 3119 #define SFXsfx0C30 3120 - - diff --git a/DataSpec/DNAMP1/SFX/PhazonGun.h b/DataSpec/DNAMP1/SFX/PhazonGun.h index fb57fa227..3198a13c6 100644 --- a/DataSpec/DNAMP1/SFX/PhazonGun.h +++ b/DataSpec/DNAMP1/SFX/PhazonGun.h @@ -5,11 +5,7 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0044 68 - #define SFXphg_charge_lp 3141 #define SFXsfx0C46 3142 - - diff --git a/DataSpec/DNAMP1/SFX/PuddleSpore.h b/DataSpec/DNAMP1/SFX/PuddleSpore.h index 4c7783a42..fd15a3356 100644 --- a/DataSpec/DNAMP1/SFX/PuddleSpore.h +++ b/DataSpec/DNAMP1/SFX/PuddleSpore.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0017 23 - #define SFXsfx0288 648 #define SFXpds_a_voxactive_00 649 #define SFXpds_b_bubbles_00 650 @@ -36,5 +34,3 @@ #define SFXsfx02A0 672 #define SFXsfx02A1 673 #define SFXsfx02A2 674 - - diff --git a/DataSpec/DNAMP1/SFX/PuddleToad.h b/DataSpec/DNAMP1/SFX/PuddleToad.h index 59a8bc477..2cb7eb3e3 100644 --- a/DataSpec/DNAMP1/SFX/PuddleToad.h +++ b/DataSpec/DNAMP1/SFX/PuddleToad.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0018 24 - #define SFXpud_a_suckin_00 675 #define SFXpud_a_spitout_00 676 #define SFXsfx02A5 677 @@ -38,5 +36,3 @@ #define SFXsfx02BD 701 #define SFXsfx02BE 702 #define SFXsfx02BF 703 - - diff --git a/DataSpec/DNAMP1/SFX/Puffer.h b/DataSpec/DNAMP1/SFX/Puffer.h index 4b1b37875..f9e42b830 100644 --- a/DataSpec/DNAMP1/SFX/Puffer.h +++ b/DataSpec/DNAMP1/SFX/Puffer.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0019 25 - #define SFXpuf_b_fly_lp_00 704 #define SFXsfx02C1 705 #define SFXsfx02C2 706 @@ -16,5 +14,3 @@ #define SFXsfx02C4 708 #define SFXsfx02C5 709 #define SFXsfx02C6 710 - - diff --git a/DataSpec/DNAMP1/SFX/ReactorDoor.h b/DataSpec/DNAMP1/SFX/ReactorDoor.h index 1491b8b23..569fdaa54 100644 --- a/DataSpec/DNAMP1/SFX/ReactorDoor.h +++ b/DataSpec/DNAMP1/SFX/ReactorDoor.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0031 49 - #define SFXdor_x_close_01 2365 #define SFXdor_x_open_01 2366 #define SFXsfx093F 2367 @@ -22,5 +20,3 @@ #define SFXsfx0947 2375 #define SFXsfx0948 2376 #define SFXsfx0949 2377 - - diff --git a/DataSpec/DNAMP1/SFX/Ridley.h b/DataSpec/DNAMP1/SFX/Ridley.h index b37c178d9..381057684 100644 --- a/DataSpec/DNAMP1/SFX/Ridley.h +++ b/DataSpec/DNAMP1/SFX/Ridley.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0038 56 - #define SFXrid_a_flamerake_00 2771 #define SFXrid_a_flame_lp_00 2772 #define SFXsfx0AD5 2773 @@ -69,5 +67,3 @@ #define SFXsfx0B0C 2828 #define SFXsfx0B0D 2829 #define SFXsfx0B0E 2830 - - diff --git a/DataSpec/DNAMP1/SFX/Ripper.h b/DataSpec/DNAMP1/SFX/Ripper.h index 916835307..af72032cf 100644 --- a/DataSpec/DNAMP1/SFX/Ripper.h +++ b/DataSpec/DNAMP1/SFX/Ripper.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup001A 26 - #define SFXrip_b_float_lp_00 711 #define SFXrip_b_scream_00 712 #define SFXsfx02C9 713 @@ -19,5 +17,3 @@ #define SFXsfx02CE 718 #define SFXsfx02CF 719 #define SFXsfx02D0 720 - - diff --git a/DataSpec/DNAMP1/SFX/RuinsWorld.h b/DataSpec/DNAMP1/SFX/RuinsWorld.h index d14b23ecb..d6c852e93 100644 --- a/DataSpec/DNAMP1/SFX/RuinsWorld.h +++ b/DataSpec/DNAMP1/SFX/RuinsWorld.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0032 50 - #define SFXsfx094A 2378 #define SFXsfx094B 2379 #define SFXsfx094C 2380 @@ -159,5 +157,3 @@ #define SFXsfx09DD 2525 #define SFXsfx09DE 2526 #define SFXsfx09DF 2527 - - diff --git a/DataSpec/DNAMP1/SFX/SamusShip.h b/DataSpec/DNAMP1/SFX/SamusShip.h index 4789c3d3a..7c98499a8 100644 --- a/DataSpec/DNAMP1/SFX/SamusShip.h +++ b/DataSpec/DNAMP1/SFX/SamusShip.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup002A 42 - #define SFXsas_x_dooropen_00 1724 #define SFXsas_x_dooropen_01 1725 #define SFXsas_x_dooropen_02 1726 @@ -41,5 +39,3 @@ #define SFXsfx06D9 1753 #define SFXsfx06DA 1754 #define SFXsfx06DB 1755 - - diff --git a/DataSpec/DNAMP1/SFX/Scarab.h b/DataSpec/DNAMP1/SFX/Scarab.h index 65e08fe61..379822ea4 100644 --- a/DataSpec/DNAMP1/SFX/Scarab.h +++ b/DataSpec/DNAMP1/SFX/Scarab.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup001B 27 - #define SFXsfx02D1 721 #define SFXsfx02D2 722 #define SFXsfx02D3 723 @@ -17,5 +15,3 @@ #define SFXsfx02D6 726 #define SFXsfx02D7 727 #define SFXsfx02D8 728 - - diff --git a/DataSpec/DNAMP1/SFX/Seedling.h b/DataSpec/DNAMP1/SFX/Seedling.h index 2ce6d4d3a..89b64cde3 100644 --- a/DataSpec/DNAMP1/SFX/Seedling.h +++ b/DataSpec/DNAMP1/SFX/Seedling.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup001C 28 - #define SFXsed_a_spine_00 729 #define SFXsed_b_idle_lp_00 730 #define SFXsfx02DB 731 @@ -29,5 +27,3 @@ #define SFXsfx02EA 746 #define SFXsfx02EB 747 #define SFXsfx02EC 748 - - diff --git a/DataSpec/DNAMP1/SFX/SheeGoth.h b/DataSpec/DNAMP1/SFX/SheeGoth.h index 40c230851..92c1783ae 100644 --- a/DataSpec/DNAMP1/SFX/SheeGoth.h +++ b/DataSpec/DNAMP1/SFX/SheeGoth.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup001D 29 - #define SFXshe_a_fireball_00 749 #define SFXshe_b_shake_lp_00 750 #define SFXsfx02EF 751 @@ -66,5 +64,3 @@ #define SFXsfx0323 803 #define SFXsfx0324 804 #define SFXsfx0325 805 - - diff --git a/DataSpec/DNAMP1/SFX/SnakeWeed.h b/DataSpec/DNAMP1/SFX/SnakeWeed.h index db1718a9b..329a22315 100644 --- a/DataSpec/DNAMP1/SFX/SnakeWeed.h +++ b/DataSpec/DNAMP1/SFX/SnakeWeed.h @@ -5,15 +5,11 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup001E 30 - #define SFXsfx0326 806 #define SFXsnk_b_in_00 807 #define SFXsnk_b_out_00 808 #define SFXsfx0329 809 #define SFXsfx032A 810 #define SFXsfx032B 811 - - diff --git a/DataSpec/DNAMP1/SFX/Sova.h b/DataSpec/DNAMP1/SFX/Sova.h index 58b51e269..50abf1ab6 100644 --- a/DataSpec/DNAMP1/SFX/Sova.h +++ b/DataSpec/DNAMP1/SFX/Sova.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup001F 31 - #define SFXfpr_b_walk_00 812 #define SFXfpr_b_walk_01 813 #define SFXspr_a_gun_00 814 @@ -28,5 +26,3 @@ #define SFXsfx033C 828 #define SFXsfx033D 829 #define SFXsfx033E 830 - - diff --git a/DataSpec/DNAMP1/SFX/SpacePirate.h b/DataSpec/DNAMP1/SFX/SpacePirate.h index bf0ae14ec..6ea5d2b15 100644 --- a/DataSpec/DNAMP1/SFX/SpacePirate.h +++ b/DataSpec/DNAMP1/SFX/SpacePirate.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0020 32 - #define SFXsfx033F 831 #define SFXepr_b_swordin_00 832 #define SFXepr_b_swordout_00 833 @@ -93,5 +91,3 @@ #define SFXsfx0390 912 #define SFXsfx0391 913 #define SFXsfx0392 914 - - diff --git a/DataSpec/DNAMP1/SFX/SpankWeed.h b/DataSpec/DNAMP1/SFX/SpankWeed.h index 03b66f52b..f4b957285 100644 --- a/DataSpec/DNAMP1/SFX/SpankWeed.h +++ b/DataSpec/DNAMP1/SFX/SpankWeed.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0021 33 - #define SFXspw_a_spank_00 915 #define SFXsfx0394 916 #define SFXspw_b_out_00 917 @@ -54,5 +52,3 @@ #define SFXsfx03BD 957 #define SFXsfx03BE 958 #define SFXsfx03BF 959 - - diff --git a/DataSpec/DNAMP1/SFX/Thardus.h b/DataSpec/DNAMP1/SFX/Thardus.h index 933354e18..79fdb71fa 100644 --- a/DataSpec/DNAMP1/SFX/Thardus.h +++ b/DataSpec/DNAMP1/SFX/Thardus.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0037 55 - #define SFXtha_b_voxangry_02 2703 #define SFXtha_b_move_00 2704 #define SFXsfx0A91 2705 @@ -77,5 +75,3 @@ #define SFXsfx0AD0 2768 #define SFXsfx0AD1 2769 #define SFXsfx0AD2 2770 - - diff --git a/DataSpec/DNAMP1/SFX/TheEnd.h b/DataSpec/DNAMP1/SFX/TheEnd.h index e2775ae70..5e395d9e0 100644 --- a/DataSpec/DNAMP1/SFX/TheEnd.h +++ b/DataSpec/DNAMP1/SFX/TheEnd.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0046 70 - #define SFXsfx0C4D 3149 #define SFXsh2_a_fireball_lp_00 3150 #define SFXshe_a_fireball_lp_00 3151 @@ -27,5 +25,3 @@ #define SFXsfx0C5C 3164 #define SFXsfx0C5D 3165 #define SFXsfx0C5E 3166 - - diff --git a/DataSpec/DNAMP1/SFX/Torobyte.h b/DataSpec/DNAMP1/SFX/Torobyte.h index 5a3083290..f9238d6b6 100644 --- a/DataSpec/DNAMP1/SFX/Torobyte.h +++ b/DataSpec/DNAMP1/SFX/Torobyte.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0023 35 - #define SFXocu_b_idle_00 981 #define SFXsfx03D6 982 #define SFXocu_b_blink_00 983 @@ -28,5 +26,3 @@ #define SFXsfx03E5 997 #define SFXsfx03E6 998 #define SFXsfx03E7 999 - - diff --git a/DataSpec/DNAMP1/SFX/Triclops.h b/DataSpec/DNAMP1/SFX/Triclops.h index c76c8c5cf..64d19f27e 100644 --- a/DataSpec/DNAMP1/SFX/Triclops.h +++ b/DataSpec/DNAMP1/SFX/Triclops.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0022 34 - #define SFXtri_a_attack_00 960 #define SFXtri_a_attract_00 961 #define SFXtri_b_idle_00 962 @@ -30,5 +28,3 @@ #define SFXsfx03D2 978 #define SFXsfx03D3 979 #define SFXsfx03D4 980 - - diff --git a/DataSpec/DNAMP1/SFX/Turret.h b/DataSpec/DNAMP1/SFX/Turret.h index f365b59df..2270acf80 100644 --- a/DataSpec/DNAMP1/SFX/Turret.h +++ b/DataSpec/DNAMP1/SFX/Turret.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0024 36 - #define SFXsfx03E8 1000 #define SFXtur_a_laser_00 1001 #define SFXsfx03EA 1002 @@ -36,5 +34,3 @@ #define SFXsfx0400 1024 #define SFXsfx0401 1025 #define SFXsfx0402 1026 - - diff --git a/DataSpec/DNAMP1/SFX/UI.h b/DataSpec/DNAMP1/SFX/UI.h index 10506086d..e69f94814 100644 --- a/DataSpec/DNAMP1/SFX/UI.h +++ b/DataSpec/DNAMP1/SFX/UI.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPui 40 - #define SFXui_map_rotate 1375 #define SFXui_map_zoom 1376 #define SFXui_lockon_poi 1377 @@ -99,5 +97,3 @@ #define SFXsfx05B6 1462 #define SFXsfx05B7 1463 #define SFXsfx05B8 1464 - - diff --git a/DataSpec/DNAMP1/SFX/WarWasp.h b/DataSpec/DNAMP1/SFX/WarWasp.h index 95e758a76..c2a255ead 100644 --- a/DataSpec/DNAMP1/SFX/WarWasp.h +++ b/DataSpec/DNAMP1/SFX/WarWasp.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0025 37 - #define SFXwar_b_idle_lp_00 1027 #define SFXwa2_a_stinger_00 1028 #define SFXwa2_b_idle_lp_00 1029 @@ -72,5 +70,3 @@ #define SFXsfx043F 1087 #define SFXsfx0440 1088 #define SFXsfx0441 1089 - - diff --git a/DataSpec/DNAMP1/SFX/Weapons.h b/DataSpec/DNAMP1/SFX/Weapons.h index ec2b55f35..fefbf928f 100644 --- a/DataSpec/DNAMP1/SFX/Weapons.h +++ b/DataSpec/DNAMP1/SFX/Weapons.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPweapons 43 - #define SFXwpn_bomb_drop 1756 #define SFXsfx06DD 1757 #define SFXwpn_bomb_explo 1758 @@ -145,5 +143,3 @@ #define SFXsfx0761 1889 #define SFXsfx0762 1890 #define SFXsfx0763 1891 - - diff --git a/DataSpec/DNAMP1/SFX/ZZZ.h b/DataSpec/DNAMP1/SFX/ZZZ.h index b57352b53..c77f007d8 100644 --- a/DataSpec/DNAMP1/SFX/ZZZ.h +++ b/DataSpec/DNAMP1/SFX/ZZZ.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPzzz 65 - #define SFXsfx0C16 3094 #define SFXsfx0C17 3095 #define SFXsfx0C18 3096 @@ -29,5 +27,3 @@ #define SFXsfx0C27 3111 #define SFXsfx0C28 3112 #define SFXsfx0C29 3113 - - diff --git a/DataSpec/DNAMP1/SFX/Zoomer.h b/DataSpec/DNAMP1/SFX/Zoomer.h index 4529a65bf..3473863f5 100644 --- a/DataSpec/DNAMP1/SFX/Zoomer.h +++ b/DataSpec/DNAMP1/SFX/Zoomer.h @@ -5,10 +5,8 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0036 54 - #define SFXzom_b_idle_00 2681 #define SFXsfx0A7A 2682 #define SFXsfx0A7B 2683 @@ -31,5 +29,3 @@ #define SFXsfx0A8C 2700 #define SFXsfx0A8D 2701 #define SFXsfx0A8E 2702 - - diff --git a/DataSpec/DNAMP1/SFX/lumigek.h b/DataSpec/DNAMP1/SFX/lumigek.h index e63b6f893..b00f8bcb2 100644 --- a/DataSpec/DNAMP1/SFX/lumigek.h +++ b/DataSpec/DNAMP1/SFX/lumigek.h @@ -5,15 +5,11 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0045 69 - #define SFXlum_b_idle_00 3143 #define SFXsfx0C48 3144 #define SFXsfx0C49 3145 #define SFXsfx0C4A 3146 #define SFXsfx0C4B 3147 #define SFXsfx0C4C 3148 - - diff --git a/DataSpec/DNAMP1/SFX/test.h b/DataSpec/DNAMP1/SFX/test.h index 15c659dca..26f760adc 100644 --- a/DataSpec/DNAMP1/SFX/test.h +++ b/DataSpec/DNAMP1/SFX/test.h @@ -5,13 +5,9 @@ * Date: Sat Sep 1 12:32:04 2018 */ - #define GRPgroup0035 53 - #define SNGIntro_Cinema 0 #define SNGMain_Plaza 1 #define SNGIntro_Exit 2 #define SNGEndGame 3 - - diff --git a/DataSpec/DNAMP1/STRG.cpp b/DataSpec/DNAMP1/STRG.cpp index 7ba83bbad..42e484437 100644 --- a/DataSpec/DNAMP1/STRG.cpp +++ b/DataSpec/DNAMP1/STRG.cpp @@ -412,16 +412,19 @@ void STRG::Enumerate(typename ReadYaml::StreamT& reader) { continue; if (lang.first.size() != 4) { - Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), + lang.first); return; } if (lang.second->m_type != YAML_SEQUENCE_NODE) { - Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), + lang.first); return; } for (const auto& str : lang.second->m_seqChildren) { if (str->m_type != YAML_SCALAR_NODE) { - Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), + lang.first); return; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/CMakeLists.txt b/DataSpec/DNAMP1/ScriptObjects/CMakeLists.txt index bbdc1a4ee..53cb30a51 100644 --- a/DataSpec/DNAMP1/ScriptObjects/CMakeLists.txt +++ b/DataSpec/DNAMP1/ScriptObjects/CMakeLists.txt @@ -129,15 +129,15 @@ make_dnalist( WorldTeleporter) set(ScriptObjectsMP1_SOURCES - ScriptTypes.hpp - IScriptObject.cpp - Parameters.cpp - Actor.cpp - Platform.cpp - DoorArea.cpp - Oculus.cpp - Ridley.cpp - Water.cpp - WorldTeleporter.cpp) + ScriptTypes.hpp + IScriptObject.cpp + Parameters.cpp + Actor.cpp + Platform.cpp + DoorArea.cpp + Oculus.cpp + Ridley.cpp + Water.cpp + WorldTeleporter.cpp) dataspec_add_list(DNAMP1/ScriptObjects ScriptObjectsMP1_SOURCES) diff --git a/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp b/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp index 59a06adb7..0b690e242 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp @@ -47,7 +47,7 @@ struct Magdolite : IScriptObject { charAssoc.m_cmdlRigs[cmdlHeadless] = {cskrHeadless, cinf}; charAssoc.m_cskrToCharacter[cskrHeadless] = std::make_pair(patternedInfo.animationParameters.animationCharacterSet, - fmt::format(FMT_STRING("ATTACH.HEADLESS_{}.CSKR"), cskrHeadless)); + fmt::format(FMT_STRING("ATTACH.HEADLESS_{}.CSKR"), cskrHeadless)); charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, {}, cmdlHeadless, "HEADLESS"); } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp index 4d73d1e3b..15a7abecb 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp @@ -378,14 +378,14 @@ struct ActorParameters : BigDNA { auto cinf = animParms.getCINF(pakRouter); if (cmdlXray.isValid() && cskrXray.isValid()) { charAssoc.m_cmdlRigs[cmdlXray] = {cskrXray, cinf}; - charAssoc.m_cskrToCharacter[cskrXray] = std::make_pair(animParms.animationCharacterSet, - fmt::format(FMT_STRING("ATTACH.XRAY_{}.CSKR"), cskrXray)); + charAssoc.m_cskrToCharacter[cskrXray] = + std::make_pair(animParms.animationCharacterSet, fmt::format(FMT_STRING("ATTACH.XRAY_{}.CSKR"), cskrXray)); charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlXray, "XRAY"); } if (cmdlThermal.isValid() && cskrThermal.isValid()) { charAssoc.m_cmdlRigs[cmdlThermal] = {cskrThermal, cinf}; - charAssoc.m_cskrToCharacter[cskrThermal] = - std::make_pair(animParms.animationCharacterSet, fmt::format(FMT_STRING("ATTACH.THERMAL_{}.CSKR"), cskrThermal)); + charAssoc.m_cskrToCharacter[cskrThermal] = std::make_pair( + animParms.animationCharacterSet, fmt::format(FMT_STRING("ATTACH.THERMAL_{}.CSKR"), cskrThermal)); charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlThermal, "THERMAL"); } } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp index b0868b92f..af30301ef 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp @@ -8,8 +8,7 @@ class CVar; namespace DataSpec::DNAMP1 { -#define DEFINE_CVAR_GLOBAL(name) \ - extern hecl::CVar* tw_##name; +#define DEFINE_CVAR_GLOBAL(name) extern hecl::CVar* tw_##name; DEFINE_CVAR_GLOBAL(WorldPrefix); DEFINE_CVAR_GLOBAL(FieldOfView); diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index 5ac3535f3..ed0fc2963 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -3,7 +3,7 @@ #include "DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp" namespace DataSpec::DNAMP1 { -template +template struct AT_SPECIALIZE_PARMS(true, false) CTweakTargeting final : public ITweakTargeting { AT_DECL_DNA_YAML Value x4_targetRadiusMode; diff --git a/DataSpec/DNAMP2/ANCS.cpp b/DataSpec/DNAMP2/ANCS.cpp index 512722d1a..b03a7ec70 100644 --- a/DataSpec/DNAMP2/ANCS.cpp +++ b/DataSpec/DNAMP2/ANCS.cpp @@ -346,9 +346,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate(typename Wr } } -std::string_view ANCS::CharacterSet::CharacterInfo::DNAType() { - return "DNAMP2::ANCS::CharacterSet::CharacterInfo"sv; -} +std::string_view ANCS::CharacterSet::CharacterInfo::DNAType() { return "DNAMP2::ANCS::CharacterSet::CharacterInfo"sv; } template <> void ANCS::AnimationSet::Enumerate(typename Read::StreamT& reader) { diff --git a/DataSpec/DNAMP2/ANIM.cpp b/DataSpec/DNAMP2/ANIM.cpp index ee7973e05..e1aeda1cf 100644 --- a/DataSpec/DNAMP2/ANIM.cpp +++ b/DataSpec/DNAMP2/ANIM.cpp @@ -6,10 +6,9 @@ namespace DataSpec::DNAMP2 { using ANIMOutStream = hecl::blender::ANIMOutStream; void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter& rig) const { - os.format(FMT_STRING( - "act.hecl_fps = round({})\n" - "act.hecl_looping = {}\n"), - (1.0f / mainInterval), looping ? "True" : "False"); + os.format(FMT_STRING("act.hecl_fps = round({})\n" + "act.hecl_looping = {}\n"), + (1.0f / mainInterval), looping ? "True" : "False"); auto kit = chanKeys.begin(); diff --git a/DataSpec/DNAMP2/CINF.cpp b/DataSpec/DNAMP2/CINF.cpp index 5d413320f..6136d5d91 100644 --- a/DataSpec/DNAMP2/CINF.cpp +++ b/DataSpec/DNAMP2/CINF.cpp @@ -46,26 +46,24 @@ template void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const typename PAKBridge::PAKType::IDType& cinfId) const { DNAANIM::RigInverter inverter(*this); - os.format(FMT_STRING( - "arm = bpy.data.armatures.new('CINF_{}')\n" - "arm_obj = bpy.data.objects.new(arm.name, arm)\n" - "bpy.context.scene.collection.objects.link(arm_obj)\n" - "bpy.context.view_layer.objects.active = arm_obj\n" - "bpy.ops.object.mode_set(mode='EDIT')\n" - "arm_bone_table = {{}}\n"), - cinfId); + os.format(FMT_STRING("arm = bpy.data.armatures.new('CINF_{}')\n" + "arm_obj = bpy.data.objects.new(arm.name, arm)\n" + "bpy.context.scene.collection.objects.link(arm_obj)\n" + "bpy.context.view_layer.objects.active = arm_obj\n" + "bpy.ops.object.mode_set(mode='EDIT')\n" + "arm_bone_table = {{}}\n"), + cinfId); for (const DNAANIM::RigInverter::Bone& bone : inverter.getBones()) { zeus::simd_floats originF(bone.m_origBone.origin.simd); zeus::simd_floats tailF(bone.m_tail.mSimd); - os.format(FMT_STRING( - "bone = arm.edit_bones.new('{}')\n" - "bone.head = ({},{},{})\n" - "bone.tail = ({},{},{})\n" - "bone.use_inherit_scale = False\n" - "arm_bone_table[{}] = bone\n"), - *getBoneNameFromId(bone.m_origBone.id), originF[0], originF[1], originF[2], tailF[0], tailF[1], - tailF[2], bone.m_origBone.id); + os.format(FMT_STRING("bone = arm.edit_bones.new('{}')\n" + "bone.head = ({},{},{})\n" + "bone.tail = ({},{},{})\n" + "bone.use_inherit_scale = False\n" + "arm_bone_table[{}] = bone\n"), + *getBoneNameFromId(bone.m_origBone.id), originF[0], originF[1], originF[2], tailF[0], tailF[1], tailF[2], + bone.m_origBone.id); } if constexpr (std::is_same_v) { @@ -92,7 +90,9 @@ template void CINF::sendCINFToBlender(hecl::blender::PyOutStr const UniqueID64& cinfId) const; template -std::string CINF::GetCINFArmatureName(const UniqueID& cinfId) { return fmt::format(FMT_STRING("CINF_{}"), cinfId); } +std::string CINF::GetCINFArmatureName(const UniqueID& cinfId) { + return fmt::format(FMT_STRING("CINF_{}"), cinfId); +} template std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId); template std::string CINF::GetCINFArmatureName(const UniqueID64& cinfId); @@ -186,14 +186,15 @@ bool CINF::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: auto os = conn.beginPythonOut(true); os.format(FMT_STRING("import bpy\n" - "from mathutils import Vector\n" - "bpy.context.scene.name = 'CINF_{}'\n" - "bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n" - "\n" - "# Clear Scene\n" - "if len(bpy.data.collections):\n" - " bpy.data.collections.remove(bpy.data.collections[0])\n" - "\n"), entry.id); + "from mathutils import Vector\n" + "bpy.context.scene.name = 'CINF_{}'\n" + "bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n" + "\n" + "# Clear Scene\n" + "if len(bpy.data.collections):\n" + " bpy.data.collections.remove(bpy.data.collections[0])\n" + "\n"), + entry.id); CINF cinf; cinf.read(rs); diff --git a/DataSpec/DNAMP2/CMakeLists.txt b/DataSpec/DNAMP2/CMakeLists.txt index e04014768..aeb467160 100644 --- a/DataSpec/DNAMP2/CMakeLists.txt +++ b/DataSpec/DNAMP2/CMakeLists.txt @@ -1,30 +1,30 @@ make_dnalist(MLVL - ANIM - AGSC - ANCS - CMDLMaterials - CINF - CSKR - MREA - PTLA - SAVW - DeafBabe) + ANIM + AGSC + ANCS + CMDLMaterials + CINF + CSKR + MREA + PTLA + SAVW + DeafBabe) set(DNAMP2_SOURCES - DNAMP2.hpp DNAMP2.cpp - DeafBabe.cpp - PAK.cpp - ANIM.cpp - AGSC.cpp - CINF.cpp - CSKR.cpp - CMDL.cpp - ANCS.cpp - CMDL.hpp - MREA.cpp - MAPA.hpp - MAPU.hpp - PATH.hpp - AFSM.hpp - STRG.hpp STRG.cpp) + DNAMP2.hpp DNAMP2.cpp + DeafBabe.cpp + PAK.cpp + ANIM.cpp + AGSC.cpp + CINF.cpp + CSKR.cpp + CMDL.cpp + ANCS.cpp + CMDL.hpp + MREA.cpp + MAPA.hpp + MAPU.hpp + PATH.hpp + AFSM.hpp + STRG.hpp STRG.cpp) dataspec_add_list(DNAMP2 DNAMP2_SOURCES) diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 709971698..95167ead1 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -201,8 +201,8 @@ void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath(); if (mlvl.worldNameId.isValid()) - pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, - fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId)); + pathOverrides[mlvl.worldNameId] = + hecl::ProjectPath(mlvlDirPath, fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId)); for (const MLVL::Area& area : mlvl.areas) { { @@ -213,12 +213,12 @@ void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, UniqueID32 pathId = MREA::GetPATHId(rs); if (pathId.isValid()) addTo[pathId] = zeus::CMatrix4f(area.transformMtx[0], area.transformMtx[1], area.transformMtx[2], BottomRow) - .transposed(); + .transposed(); } hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath(); if (area.areaNameId.isValid()) - pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, - fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId)); + pathOverrides[area.areaNameId] = + hecl::ProjectPath(areaDirPath, fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId)); } if (mlvl.worldMap.isValid()) { diff --git a/DataSpec/DNAMP2/DNAMP2.hpp b/DataSpec/DNAMP2/DNAMP2.hpp index ee62edc12..654073fd0 100644 --- a/DataSpec/DNAMP2/DNAMP2.hpp +++ b/DataSpec/DNAMP2/DNAMP2.hpp @@ -31,8 +31,7 @@ public: void addCMDLRigPairs(PAKRouter& pakRouter, CharacterAssociations& charAssoc) const; - void addPATHToMREA(PAKRouter& pakRouter, - std::unordered_map& pathToMrea) const; + void addPATHToMREA(PAKRouter& pakRouter, std::unordered_map& pathToMrea) const; void addMAPATransforms(PAKRouter& pakRouter, std::unordered_map& addTo, std::unordered_map& pathOverrides) const; diff --git a/DataSpec/DNAMP2/DeafBabe.cpp b/DataSpec/DNAMP2/DeafBabe.cpp index e33b2893e..00d0fd5b1 100644 --- a/DataSpec/DNAMP2/DeafBabe.cpp +++ b/DataSpec/DNAMP2/DeafBabe.cpp @@ -265,11 +265,10 @@ void DeafBabe::insertNoClimb(hecl::blender::PyOutStream& os) const { if (edgeIdx == -1) continue; const Edge& edge = edgeVertConnections[edgeIdx]; - os.format(FMT_STRING( - "edge = col_bm.edges.get((col_bm.verts[{}], col_bm.verts[{}]))\n" - "if edge:\n" - " edge.seam = True\n"), - edge.verts[0], edge.verts[1]); + os.format(FMT_STRING("edge = col_bm.edges.get((col_bm.verts[{}], col_bm.verts[{}]))\n" + "if edge:\n" + " edge.seam = True\n"), + edge.verts[0], edge.verts[1]); } } diff --git a/DataSpec/DNAMP2/MREA.cpp b/DataSpec/DNAMP2/MREA.cpp index 57d9f828b..fa763b6d8 100644 --- a/DataSpec/DNAMP2/MREA.cpp +++ b/DataSpec/DNAMP2/MREA.cpp @@ -225,13 +225,12 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: /* Open Py Stream and read sections */ hecl::blender::PyOutStream os = conn.beginPythonOut(true); - os.format(FMT_STRING( - "import bpy\n" - "import bmesh\n" - "from mathutils import Vector\n" - "\n" - "bpy.context.scene.name = '{}'\n"), - pakRouter.getBestEntryName(entry, false)); + os.format(FMT_STRING("import bpy\n" + "import bmesh\n" + "from mathutils import Vector\n" + "\n" + "bpy.context.scene.name = '{}'\n"), + pakRouter.getBestEntryName(entry, false)); DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath()); MaterialSet::RegisterMaterialProps(os); os << "# Clear Scene\n" @@ -272,13 +271,13 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin); curSec += DNACMDL::ReadGeomSectionsToBlender, MaterialSet, RigPair, DNACMDL::SurfaceHeader_2>( os, drs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]); - os.format(FMT_STRING( - "obj.retro_disable_enviro_visor = {}\n" - "obj.retro_disable_thermal_visor = {}\n" - "obj.retro_disable_xray_visor = {}\n" - "obj.retro_thermal_level = '{}'\n"), - mHeader.visorFlags.disableEnviro() ? "True" : "False", mHeader.visorFlags.disableThermal() ? "True" : "False", - mHeader.visorFlags.disableXray() ? "True" : "False", mHeader.visorFlags.thermalLevelStr()); + os.format(FMT_STRING("obj.retro_disable_enviro_visor = {}\n" + "obj.retro_disable_thermal_visor = {}\n" + "obj.retro_disable_xray_visor = {}\n" + "obj.retro_thermal_level = '{}'\n"), + mHeader.visorFlags.disableEnviro() ? "True" : "False", + mHeader.visorFlags.disableThermal() ? "True" : "False", + mHeader.visorFlags.disableXray() ? "True" : "False", mHeader.visorFlags.thermalLevelStr()); /* Seek through AROT-relation sections */ drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current); diff --git a/DataSpec/DNAMP2/STRG.cpp b/DataSpec/DNAMP2/STRG.cpp index f678d4fc0..d48ea8fb2 100644 --- a/DataSpec/DNAMP2/STRG.cpp +++ b/DataSpec/DNAMP2/STRG.cpp @@ -158,16 +158,19 @@ void STRG::Enumerate(athena::io::YAMLDocReader& reader) { if (lang.first == "names") continue; if (lang.first.size() != 4) { - Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), + lang.first); return; } if (lang.second->m_type != YAML_SEQUENCE_NODE) { - Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), + lang.first); return; } for (const auto& str : lang.second->m_seqChildren) { if (str->m_type != YAML_SCALAR_NODE) { - Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), + lang.first); return; } } diff --git a/DataSpec/DNAMP3/ANIM.cpp b/DataSpec/DNAMP3/ANIM.cpp index 38e91c41a..e35825894 100644 --- a/DataSpec/DNAMP3/ANIM.cpp +++ b/DataSpec/DNAMP3/ANIM.cpp @@ -9,11 +9,10 @@ using ANIMOutStream = hecl::blender::ANIMOutStream; void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter& rig, bool additive) const { - os.format(FMT_STRING( - "act.hecl_fps = round({})\n" - "act.hecl_additive = {}\n" - "act.hecl_looping = {}\n"), - 1.0f / mainInterval, additive ? "True" : "False", looping ? "True" : "False"); + os.format(FMT_STRING("act.hecl_fps = round({})\n" + "act.hecl_additive = {}\n" + "act.hecl_looping = {}\n"), + 1.0f / mainInterval, additive ? "True" : "False", looping ? "True" : "False"); auto kit = chanKeys.begin() + 1; diff --git a/DataSpec/DNAMP3/CMDLMaterials.cpp b/DataSpec/DNAMP3/CMDLMaterials.cpp index 3466f1122..91a0d143c 100644 --- a/DataSpec/DNAMP3/CMDLMaterials.cpp +++ b/DataSpec/DNAMP3/CMDLMaterials.cpp @@ -10,7 +10,9 @@ template <> void MaterialSet::Material::Enumerate(typename Read::StreamT& reader) { header.read(reader); chunks.clear(); - do { chunks.emplace_back().read(reader); } while (!chunks.back().holds_alternative()); + do { + chunks.emplace_back().read(reader); + } while (!chunks.back().holds_alternative()); chunks.pop_back(); } template <> @@ -31,11 +33,13 @@ void MaterialSet::Material::Enumerate(typename BinarySize::S void MaterialSet::RegisterMaterialProps(Stream& out) { out << "bpy.types.Material.retro_enable_bloom = bpy.props.BoolProperty(name='Retro: Enable Bloom')\n" "bpy.types.Material.retro_force_lighting_stage = bpy.props.BoolProperty(name='Retro: Force Lighting Stage')\n" - "bpy.types.Material.retro_pre_inca_transparency = bpy.props.BoolProperty(name='Retro: Pre-INCA Transparency')\n" + "bpy.types.Material.retro_pre_inca_transparency = bpy.props.BoolProperty(name='Retro: Pre-INCA " + "Transparency')\n" "bpy.types.Material.retro_alpha_test = bpy.props.BoolProperty(name='Retro: Alpha Test')\n" "bpy.types.Material.retro_shadow_occluder = bpy.props.BoolProperty(name='Retro: Shadow Occluder')\n" "bpy.types.Material.retro_solid_white = bpy.props.BoolProperty(name='Retro: Solid White Only')\n" - "bpy.types.Material.retro_reflection_alpha_target = bpy.props.BoolProperty(name='Retro: Reflection Alpha Target')\n" + "bpy.types.Material.retro_reflection_alpha_target = bpy.props.BoolProperty(name='Retro: Reflection Alpha " + "Target')\n" "bpy.types.Material.retro_solid_color = bpy.props.BoolProperty(name='Retro: Solid Color Only')\n" "bpy.types.Material.retro_exclude_scan = bpy.props.BoolProperty(name='Retro: Exclude From Scan Visor')\n" "bpy.types.Material.retro_xray_opaque = bpy.props.BoolProperty(name='Retro: XRay Opaque')\n" @@ -44,8 +48,8 @@ void MaterialSet::RegisterMaterialProps(Stream& out) { "\n"; } -static void LoadTexture(Stream& out, const UniqueID64& tex, - const PAKRouter& pakRouter, const PAK::Entry& entry) { +static void LoadTexture(Stream& out, const UniqueID64& tex, const PAKRouter& pakRouter, + const PAK::Entry& entry) { if (!tex.isValid()) { out << "image = None\n"; return; @@ -62,11 +66,12 @@ static void LoadTexture(Stream& out, const UniqueID64& tex, hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex); hecl::SystemUTF8Conv resPathView(resPath); out.format(FMT_STRING("if '{}' in bpy.data.images:\n" - " image = bpy.data.images['{}']\n" - "else:\n" - " image = bpy.data.images.load('''//{}''')\n" - " image.name = '{}'\n" - "\n"), texName, texName, resPathView, texName); + " image = bpy.data.images['{}']\n" + "else:\n" + " image = bpy.data.images.load('''//{}''')\n" + " image.name = '{}'\n" + "\n"), + texName, texName, resPathView, texName); } void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter& pakRouter, const PAK::Entry& entry, @@ -91,30 +96,29 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter& pak "\n"; /* Material Flags */ - out.format(FMT_STRING( - "new_material.retro_enable_bloom = {}\n" - "new_material.retro_force_lighting_stage = {}\n" - "new_material.retro_pre_inca_transparency = {}\n" - "new_material.retro_alpha_test = {}\n" - "new_material.retro_shadow_occluder = {}\n" - "new_material.retro_solid_white = {}\n" - "new_material.retro_reflection_alpha_target = {}\n" - "new_material.retro_solid_color = {}\n" - "new_material.retro_exclude_scan = {}\n" - "new_material.retro_xray_opaque = {}\n" - "new_material.retro_xray_alpha_target = {}\n" - "new_material.retro_inca_color_mod = False\n"), - material.header.flags.enableBloom() ? "True" : "False", - material.header.flags.forceLightingStage() ? "True" : "False", - material.header.flags.preIncaTransparency() ? "True" : "False", - material.header.flags.alphaTest() ? "True" : "False", - material.header.flags.shadowOccluderMesh() ? "True" : "False", - material.header.flags.justWhite() ? "True" : "False", - material.header.flags.reflectionAlphaTarget() ? "True" : "False", - material.header.flags.justSolidColor() ? "True" : "False", - material.header.flags.excludeFromScanVisor() ? "True" : "False", - material.header.flags.xrayOpaque() ? "True" : "False", - material.header.flags.xrayAlphaTarget() ? "True" : "False"); + out.format(FMT_STRING("new_material.retro_enable_bloom = {}\n" + "new_material.retro_force_lighting_stage = {}\n" + "new_material.retro_pre_inca_transparency = {}\n" + "new_material.retro_alpha_test = {}\n" + "new_material.retro_shadow_occluder = {}\n" + "new_material.retro_solid_white = {}\n" + "new_material.retro_reflection_alpha_target = {}\n" + "new_material.retro_solid_color = {}\n" + "new_material.retro_exclude_scan = {}\n" + "new_material.retro_xray_opaque = {}\n" + "new_material.retro_xray_alpha_target = {}\n" + "new_material.retro_inca_color_mod = False\n"), + material.header.flags.enableBloom() ? "True" : "False", + material.header.flags.forceLightingStage() ? "True" : "False", + material.header.flags.preIncaTransparency() ? "True" : "False", + material.header.flags.alphaTest() ? "True" : "False", + material.header.flags.shadowOccluderMesh() ? "True" : "False", + material.header.flags.justWhite() ? "True" : "False", + material.header.flags.reflectionAlphaTarget() ? "True" : "False", + material.header.flags.justSolidColor() ? "True" : "False", + material.header.flags.excludeFromScanVisor() ? "True" : "False", + material.header.flags.xrayOpaque() ? "True" : "False", + material.header.flags.xrayAlphaTarget() ? "True" : "False"); out << "pnode = new_nodetree.nodes.new('ShaderNodeGroup')\n" "pnode.name = 'Output'\n" @@ -146,16 +150,22 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter& pak "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n"; break; case Material::UVAnimationUVSource::UV: - out.format(FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n" - "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n" - "tex_uv_node.uv_map = 'UV_{}'\n"), pass->uvSrc); + out.format( + FMT_STRING( + "tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n" + "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n" + "tex_uv_node.uv_map = 'UV_{}'\n"), + pass->uvSrc); break; } out.format(FMT_STRING("tex_uv_node.label = 'MTX_{}'\n"), texMtxIdx); } else { - out.format(FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n" - "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n" - "tex_uv_node.uv_map = 'UV_{}'\n"), pass->uvSrc); + out.format( + FMT_STRING( + "tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n" + "tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n" + "tex_uv_node.uv_map = 'UV_{}'\n"), + pass->uvSrc); } out << "gridder.place_node(tex_uv_node, 0)\n" @@ -218,7 +228,8 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter& pak DoSwap(); out << "new_nodetree.links.new(swap_output, pnode.inputs['INCAA'])\n"; } - out.format(FMT_STRING("new_material.retro_inca_color_mod = {}\n"), pass->flags.INCAColorMod() ? "True" : "False"); + out.format(FMT_STRING("new_material.retro_inca_color_mod = {}\n"), + pass->flags.INCAColorMod() ? "True" : "False"); break; case Subtype::RFLV: out << "new_nodetree.links.new(tex_node.outputs['Color'], pnode.inputs['RFLV'])\n"; @@ -254,12 +265,12 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter& pak switch (Subtype(clr->subtype.toUint32())) { case Subtype::CLR: out.format(FMT_STRING("pnode.inputs['CLR'].default_value = ({}, {}, {}, 1.0)\n" - "pnode.inputs['CLRA'].default_value = {}\n"), + "pnode.inputs['CLRA'].default_value = {}\n"), vec4[0], vec4[1], vec4[2], vec4[3]); break; case Subtype::DIFB: out.format(FMT_STRING("pnode.inputs['DIFBC'].default_value = ({}, {}, {}, 1.0)\n" - "pnode.inputs['DIFBA'].default_value = {}\n"), + "pnode.inputs['DIFBA'].default_value = {}\n"), vec4[0], vec4[1], vec4[2], vec4[3]); break; default: diff --git a/DataSpec/DNAMP3/CMDLMaterials.hpp b/DataSpec/DNAMP3/CMDLMaterials.hpp index 89d562a72..f933974a7 100644 --- a/DataSpec/DNAMP3/CMDLMaterials.hpp +++ b/DataSpec/DNAMP3/CMDLMaterials.hpp @@ -102,9 +102,7 @@ struct MaterialSet : BigDNA { const Header::Flags& getFlags() const { return header.flags; } const VAFlags& getVAFlags() const { return header.vaFlags; } - enum class ChunkType : atUint32 { - PASS = 'PASS', CLR = 'CLR ', INT = 'INT ', END = 'END ' - }; + enum class ChunkType : atUint32 { PASS = 'PASS', CLR = 'CLR ', INT = 'INT ', END = 'END ' }; struct PASS : hecl::TypedRecordBigDNA { AT_DECL_DNA diff --git a/DataSpec/DNAMP3/CMakeLists.txt b/DataSpec/DNAMP3/CMakeLists.txt index e4950978b..68a9cf943 100644 --- a/DataSpec/DNAMP3/CMakeLists.txt +++ b/DataSpec/DNAMP3/CMakeLists.txt @@ -1,27 +1,27 @@ make_dnalist(PAK - MLVL - ANIM - CHAR - CMDLMaterials - CINF - CSKR - MREA - SAVW - CAUD - HINT - SAND) + MLVL + ANIM + CHAR + CMDLMaterials + CINF + CSKR + MREA + SAVW + CAUD + HINT + SAND) set(DNAMP3_SOURCES - DNAMP3.hpp DNAMP3.cpp - PAK.cpp - ANIM.cpp - CINF.hpp - CHAR.cpp - CMDL.hpp CMDL.cpp - CMDLMaterials.cpp - CSKR.cpp - PATH.hpp - STRG.hpp STRG.cpp - MAPA.hpp - MREA.cpp) + DNAMP3.hpp DNAMP3.cpp + PAK.cpp + ANIM.cpp + CINF.hpp + CHAR.cpp + CMDL.hpp CMDL.cpp + CMDLMaterials.cpp + CSKR.cpp + PATH.hpp + STRG.hpp STRG.cpp + MAPA.hpp + MREA.cpp) dataspec_add_list(DNAMP3 DNAMP3_SOURCES) diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index 0a284b06d..a38ffefc0 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -169,8 +169,8 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, CharacterAssoci std::make_pair(entry.second.id, fmt::format(FMT_STRING("{}_{}.CSKR"), ci.name, ci.cskr)); for (const CHAR::CharacterInfo::Overlay& overlay : ci.overlays) { charAssoc.m_cmdlRigs[overlay.cmdl] = {overlay.cskr, ci.cinf}; - charAssoc.m_cskrToCharacter[overlay.cskr] = - std::make_pair(entry.second.id, fmt::format(FMT_STRING("{}.{}_{}.CSKR"), ci.name, overlay.type, overlay.cskr)); + charAssoc.m_cskrToCharacter[overlay.cskr] = std::make_pair( + entry.second.id, fmt::format(FMT_STRING("{}.{}_{}.CSKR"), ci.name, overlay.type, overlay.cskr)); } } } @@ -191,8 +191,8 @@ void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath(); if (mlvl.worldNameId.isValid()) - pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, - fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId)); + pathOverrides[mlvl.worldNameId] = + hecl::ProjectPath(mlvlDirPath, fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId)); for (const MLVL::Area& area : mlvl.areas) { { @@ -203,12 +203,12 @@ void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, UniqueID64 pathId = MREA::GetPATHId(rs); if (pathId.isValid()) addTo[pathId] = zeus::CMatrix4f(area.transformMtx[0], area.transformMtx[1], area.transformMtx[2], BottomRow) - .transposed(); + .transposed(); } hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath(); if (area.areaNameId.isValid()) - pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, - fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId)); + pathOverrides[area.areaNameId] = + hecl::ProjectPath(areaDirPath, fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId)); } if (mlvl.worldMap.isValid()) { diff --git a/DataSpec/DNAMP3/MREA.cpp b/DataSpec/DNAMP3/MREA.cpp index 474acb865..c0089f228 100644 --- a/DataSpec/DNAMP3/MREA.cpp +++ b/DataSpec/DNAMP3/MREA.cpp @@ -100,13 +100,12 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl: /* Open Py Stream and read sections */ hecl::blender::PyOutStream os = conn.beginPythonOut(true); - os.format(FMT_STRING( - "import bpy\n" - "import bmesh\n" - "from mathutils import Vector\n" - "\n" - "bpy.context.scene.name = '{}'\n"), - pakRouter.getBestEntryName(entry, false)); + os.format(FMT_STRING("import bpy\n" + "import bmesh\n" + "from mathutils import Vector\n" + "\n" + "bpy.context.scene.name = '{}'\n"), + pakRouter.getBestEntryName(entry, false)); DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath()); MaterialSet::RegisterMaterialProps(os); os << "# Clear Scene\n" diff --git a/DataSpec/DNAMP3/STRG.cpp b/DataSpec/DNAMP3/STRG.cpp index e1b7906bc..9ac591919 100644 --- a/DataSpec/DNAMP3/STRG.cpp +++ b/DataSpec/DNAMP3/STRG.cpp @@ -82,16 +82,19 @@ void STRG::Enumerate(athena::io::YAMLDocReader& reader) { if (lang.first == "names") continue; if (lang.first.size() != 4) { - Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), + lang.first); return; } if (lang.second->m_type != YAML_SEQUENCE_NODE) { - Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), + lang.first); return; } for (const auto& str : lang.second->m_seqChildren) { if (str->m_type != YAML_SCALAR_NODE) { - Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), lang.first); + Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), + lang.first); return; } } diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 74b576472..aef52fa55 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -1232,11 +1232,7 @@ void SpecBase::WriteVersionInfo(hecl::Database::Project& project, const hecl::Pr athena::io::FileWriter writer(versionPath.getAbsolutePath()); athena::io::ToYAMLStream(info, writer); } -void SpecBase::setCurRegion(ERegion region) { - g_CurRegion = region; -} -void SpecBase::setCurSpecIsWii(bool isWii) { - g_CurSpecIsWii = isWii; -} +void SpecBase::setCurRegion(ERegion region) { g_CurRegion = region; } +void SpecBase::setCurSpecIsWii(bool isWii) { g_CurSpecIsWii = isWii; } } // namespace DataSpec diff --git a/DataSpec/SpecBase.hpp b/DataSpec/SpecBase.hpp index f9e99bee7..487562af9 100644 --- a/DataSpec/SpecBase.hpp +++ b/DataSpec/SpecBase.hpp @@ -183,8 +183,8 @@ protected: bool m_backgroundRunning = false; void readCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAMLDocWriter& nameWriter); - void insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const metaforce::SObjectTag& tag, const hecl::ProjectPath& path, - bool dump = true); + void insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const metaforce::SObjectTag& tag, + const hecl::ProjectPath& path, bool dump = true); bool addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDocWriter& cacheWriter); void backgroundIndexRecursiveProc(const hecl::ProjectPath& path, athena::io::YAMLDocWriter& cacheWriter, athena::io::YAMLDocWriter& nameWriter, int level); @@ -196,8 +196,9 @@ protected: std::unordered_set& addedTags, const hecl::ProjectPath& path, hecl::blender::Token& btok); void copyBuildListData(std::vector>& fileIndex, - const std::vector& buildList, const hecl::Database::DataSpecEntry* entry, - bool fast, const hecl::MultiProgressPrinter& progress, athena::io::FileWriter& pakOut, + const std::vector& buildList, + const hecl::Database::DataSpecEntry* entry, bool fast, + const hecl::MultiProgressPrinter& progress, athena::io::FileWriter& pakOut, const std::unordered_map>& mlvlData); std::unique_ptr m_disc; diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index effe4079c..0b87313ac 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -992,8 +992,8 @@ struct SpecMP1 : SpecBase { } void buildWorldPakList(const hecl::ProjectPath& worldPath, const hecl::ProjectPath& worldPathCooked, - hecl::blender::Token& btok, athena::io::FileWriter& w, std::vector& listOut, - atUint64& resTableOffset, + hecl::blender::Token& btok, athena::io::FileWriter& w, + std::vector& listOut, atUint64& resTableOffset, std::unordered_map>& mlvlData) override { DNAMP1::MLVL mlvl; { @@ -1151,7 +1151,8 @@ struct SpecMP1 : SpecBase { } } - void buildPakList(hecl::blender::Token& btok, athena::io::FileWriter& w, const std::vector& list, + void buildPakList(hecl::blender::Token& btok, athena::io::FileWriter& w, + const std::vector& list, const std::vector>& nameList, atUint64& resTableOffset) override { w.writeUint32Big(m_pc ? 0x80030005 : 0x00030005); diff --git a/DataSpec/SpecMP2.cpp b/DataSpec/SpecMP2.cpp index 8cecc577c..e226ea999 100644 --- a/DataSpec/SpecMP2.cpp +++ b/DataSpec/SpecMP2.cpp @@ -30,7 +30,8 @@ extern hecl::Database::DataSpecEntry SpecEntMP2; extern hecl::Database::DataSpecEntry SpecEntMP2ORIG; struct TextureCache { - static void Generate(PAKRouter& pakRouter, hecl::Database::Project& project, const hecl::ProjectPath& pakPath) { + static void Generate(PAKRouter& pakRouter, hecl::Database::Project& project, + const hecl::ProjectPath& pakPath) { hecl::ProjectPath texturePath(pakPath, _SYS_STR("texture_cache.yaml")); hecl::ProjectPath catalogPath(pakPath, _SYS_STR("!catalog.yaml")); texturePath.makeDirChain(false); @@ -79,9 +80,8 @@ struct TextureCache { metaPairs.emplace_back(projectPath.parsedHash32(), meta); } - std::sort(metaPairs.begin(), metaPairs.end(), [](const auto& a, const auto& b) -> bool { - return a.first < b.first; - }); + std::sort(metaPairs.begin(), metaPairs.end(), + [](const auto& a, const auto& b) -> bool { return a.first < b.first; }); athena::io::FileWriter w(outPath.getAbsolutePath()); w.writeUint32Big(metaPairs.size()); @@ -185,7 +185,8 @@ struct SpecMP2 : SpecBase { const std::vector& args, std::vector& reps) override { nod::IPartition* partition = disc.getDataPartition(); std::unique_ptr dolBuf = partition->getDOLBuf(); - const char* buildInfo = static_cast(memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19; + const char* buildInfo = + static_cast(memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19; if (buildInfo == nullptr) { return false; } diff --git a/DataSpec/SpecMP3.cpp b/DataSpec/SpecMP3.cpp index 1199a33ca..5c3dbb012 100644 --- a/DataSpec/SpecMP3.cpp +++ b/DataSpec/SpecMP3.cpp @@ -27,7 +27,8 @@ extern hecl::Database::DataSpecEntry SpecEntMP3; extern hecl::Database::DataSpecEntry SpecEntMP3ORIG; struct TextureCache { - static void Generate(PAKRouter& pakRouter, hecl::Database::Project& project, const hecl::ProjectPath& pakPath) { + static void Generate(PAKRouter& pakRouter, hecl::Database::Project& project, + const hecl::ProjectPath& pakPath) { hecl::ProjectPath texturePath(pakPath, _SYS_STR("texture_cache.yaml")); hecl::ProjectPath catalogPath(pakPath, _SYS_STR("!catalog.yaml")); texturePath.makeDirChain(false); @@ -76,9 +77,8 @@ struct TextureCache { metaPairs.emplace_back(projectPath.parsedHash32(), meta); } - std::sort(metaPairs.begin(), metaPairs.end(), [](const auto& a, const auto& b) -> bool { - return a.first < b.first; - }); + std::sort(metaPairs.begin(), metaPairs.end(), + [](const auto& a, const auto& b) -> bool { return a.first < b.first; }); athena::io::FileWriter w(outPath.getAbsolutePath()); w.writeUint32Big(metaPairs.size()); @@ -223,7 +223,8 @@ struct SpecMP3 : SpecBase { doMP3 = true; nod::IPartition* partition = disc.getDataPartition(); std::unique_ptr dolBuf = partition->getDOLBuf(); - const char* buildInfo = static_cast(memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19; + const char* buildInfo = + static_cast(memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16)) + 19; if (buildInfo == nullptr) { return false; } diff --git a/Runtime/Audio/CMakeLists.txt b/Runtime/Audio/CMakeLists.txt index d83202cd0..155e720d2 100644 --- a/Runtime/Audio/CMakeLists.txt +++ b/Runtime/Audio/CMakeLists.txt @@ -1,10 +1,10 @@ set(AUDIO_SOURCES - CAudioSys.hpp CAudioSys.cpp - CAudioGroupSet.hpp CAudioGroupSet.cpp - CSfxManager.hpp CSfxManager.cpp - CMidiManager.hpp CMidiManager.cpp - CStaticAudioPlayer.hpp CStaticAudioPlayer.cpp - CStreamAudioManager.hpp CStreamAudioManager.cpp - g721.c g721.h) + CAudioSys.hpp CAudioSys.cpp + CAudioGroupSet.hpp CAudioGroupSet.cpp + CSfxManager.hpp CSfxManager.cpp + CMidiManager.hpp CMidiManager.cpp + CStaticAudioPlayer.hpp CStaticAudioPlayer.cpp + CStreamAudioManager.hpp CStreamAudioManager.cpp + g721.c g721.h) runtime_add_list(Audio AUDIO_SOURCES) diff --git a/Runtime/Audio/CSfxManager.hpp b/Runtime/Audio/CSfxManager.hpp index 66fff0155..9c237c302 100644 --- a/Runtime/Audio/CSfxManager.hpp +++ b/Runtime/Audio/CSfxManager.hpp @@ -110,10 +110,7 @@ public: void SetTimeRemaining(float t) { x4_timeRemaining = t; } CBaseSfxWrapper(bool looped, s16 prio, /*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area) - : xa_prio(prio) - , /*xc_handle(handle),*/ x10_area(area) - , x14_26_looped(looped) - , x14_29_useAcoustics(useAcoustics) {} + : xa_prio(prio), /*xc_handle(handle),*/ x10_area(area), x14_26_looped(looped), x14_29_useAcoustics(useAcoustics) {} }; class CSfxEmitterWrapper : public CBaseSfxWrapper { diff --git a/Runtime/Audio/CStaticAudioPlayer.cpp b/Runtime/Audio/CStaticAudioPlayer.cpp index 713b73c1a..d8c34c743 100644 --- a/Runtime/Audio/CStaticAudioPlayer.cpp +++ b/Runtime/Audio/CStaticAudioPlayer.cpp @@ -46,8 +46,7 @@ bool CStaticAudioPlayer::IsReady() { } void CStaticAudioPlayer::DecodeMonoAndMix(s16* bufOut, u32 numSamples, u32 cur, u32 loopEndCur, u32 loopStartCur, - int vol, g72x_state& state, - std::optional& loopState) const { + int vol, g72x_state& state, std::optional& loopState) const { for (u32 remBytes = numSamples / 2; remBytes;) { u32 curBuf = cur / RSF_BUFFER_SIZE; u32 thisBytes = (curBuf + 1) * RSF_BUFFER_SIZE - cur; diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index cfdc93a3d..8d506b9d9 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -617,21 +617,21 @@ void CAutoMapper::ProcessMapZoomInput(const CFinalInput& input, const CStateMana } const EZoomState nextZoomState = [this, in, out] { - switch (x324_zoomState) { - case EZoomState::None: - case EZoomState::In: - case EZoomState::Out: - if (in) { - return EZoomState::In; - } - if (out) { - return EZoomState::Out; - } - return EZoomState::None; + switch (x324_zoomState) { + case EZoomState::None: + case EZoomState::In: + case EZoomState::Out: + if (in) { + return EZoomState::In; + } + if (out) { + return EZoomState::Out; + } + return EZoomState::None; - default: - return EZoomState::None; - } + default: + return EZoomState::None; + } }(); x324_zoomState = nextZoomState; @@ -1049,7 +1049,8 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager x308_textpane_instructions2->TextSupport().SetText(u""); } else { x2fc_textpane_hint->TextSupport().SetText(u""); - std::u16string str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]); + std::u16string str = + fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]); str += g_MainStringTable->GetString(46 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Rotate x300_textpane_instructions->TextSupport().SetText(str); str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]); diff --git a/Runtime/AutoMapper/CMakeLists.txt b/Runtime/AutoMapper/CMakeLists.txt index cd8d20217..bd782888a 100644 --- a/Runtime/AutoMapper/CMakeLists.txt +++ b/Runtime/AutoMapper/CMakeLists.txt @@ -1,9 +1,9 @@ set(AUTOMAPPER_SOURCES - CMapUniverse.hpp CMapUniverse.cpp - CMapWorldInfo.hpp CMapWorldInfo.cpp - CMapWorld.hpp CMapWorld.cpp - CMapArea.hpp CMapArea.cpp - CMappableObject.hpp CMappableObject.cpp - CAutoMapper.hpp CAutoMapper.cpp) + CMapUniverse.hpp CMapUniverse.cpp + CMapWorldInfo.hpp CMapWorldInfo.cpp + CMapWorld.hpp CMapWorld.cpp + CMapArea.hpp CMapArea.cpp + CMappableObject.hpp CMappableObject.cpp + CAutoMapper.hpp CAutoMapper.cpp) runtime_add_list(AutoMapper AUTOMAPPER_SOURCES) diff --git a/Runtime/AutoMapper/CMapUniverse.hpp b/Runtime/AutoMapper/CMapUniverse.hpp index d609cf505..27cc58fff 100644 --- a/Runtime/AutoMapper/CMapUniverse.hpp +++ b/Runtime/AutoMapper/CMapUniverse.hpp @@ -35,8 +35,8 @@ public: , xc_closestHex(closestHex) , x10_flashPulse(flashPulse) , - // x14_mgr(mgr), - x18_model(model) + // x14_mgr(mgr), + x18_model(model) , x1c_view(view) {} int GetFocusWorldIndex() const { return x4_wldIdx; } const zeus::CTransform& GetCameraTransform() const { return x1c_view; } diff --git a/Runtime/AutoMapper/CMapWorld.cpp b/Runtime/AutoMapper/CMapWorld.cpp index fe58b2c0f..2b3711bcd 100644 --- a/Runtime/AutoMapper/CMapWorld.cpp +++ b/Runtime/AutoMapper/CMapWorld.cpp @@ -36,8 +36,8 @@ Circle2 ExactCircle1(const zeus::CVector2f* a) { Circle2 ExactCircle2(const zeus::CVector2f* a, const zeus::CVector2f* b) { return { - .x0_point = 0.5f * (*a + *b), - .x8_radiusSq = (*b - *a).magSquared() * 0.25f, + .x0_point = 0.5f * (*a + *b), + .x8_radiusSq = (*b - *a).magSquared() * 0.25f, }; } @@ -689,9 +689,7 @@ zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point, return ret; } -void CMapWorld::ClearTraversedFlags() { - std::fill(x20_traversed.begin(), x20_traversed.end(), false); -} +void CMapWorld::ClearTraversedFlags() { std::fill(x20_traversed.begin(), x20_traversed.end(), false); } CFactoryFnReturn FMapWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param, CObjectReference* selfRef) { diff --git a/Runtime/CDvdFile.hpp b/Runtime/CDvdFile.hpp index 53a3d2357..f49018566 100644 --- a/Runtime/CDvdFile.hpp +++ b/Runtime/CDvdFile.hpp @@ -44,8 +44,7 @@ public: static void Shutdown(); CDvdFile(std::string_view path) - : x18_path(path) - , m_reader(std::make_shared(ResolvePath(path).getAbsolutePath())) {} + : x18_path(path), m_reader(std::make_shared(ResolvePath(path).getAbsolutePath())) {} operator bool() const { return m_reader->isOpen(); } void UpdateFilePos(int pos) { m_reader->seek(pos, athena::SeekOrigin::Begin); } static bool FileExists(std::string_view path) { return ResolvePath(path).isFile(); } diff --git a/Runtime/CGameOptionsTouchBar.cpp b/Runtime/CGameOptionsTouchBar.cpp index b9789a109..fc89bb8a5 100644 --- a/Runtime/CGameOptionsTouchBar.cpp +++ b/Runtime/CGameOptionsTouchBar.cpp @@ -10,8 +10,8 @@ void CGameOptionsTouchBar::GetSelection(int& left, int& right, int& value) { value = -1; } -void CGameOptionsTouchBar::SetSelection([[maybe_unused]] int left, [[maybe_unused]] int right, [[maybe_unused]] int value) { -} +void CGameOptionsTouchBar::SetSelection([[maybe_unused]] int left, [[maybe_unused]] int right, + [[maybe_unused]] int value) {} #ifndef __APPLE__ std::unique_ptr NewGameOptionsTouchBar() { return std::make_unique(); } diff --git a/Runtime/CGameOptionsTouchBarMac.mm b/Runtime/CGameOptionsTouchBarMac.mm index 334e1460e..5c7a98722 100644 --- a/Runtime/CGameOptionsTouchBarMac.mm +++ b/Runtime/CGameOptionsTouchBarMac.mm @@ -1,307 +1,260 @@ -#include -#include "CGameOptionsTouchBar.hpp" #include "CGameOptions.hpp" +#include "CGameOptionsTouchBar.hpp" #include "GameGlobalObjects.hpp" -#include "MP1/MP1.hpp" #include "GuiSys/CStringTable.hpp" +#include "MP1/MP1.hpp" +#include #if !__has_feature(objc_arc) #error ARC Required #endif -static NSColor* BlueConfirm() -{ - return [NSColor colorWithSRGBRed:0/255.f green:130/255.f blue:215/255.f alpha:1.f]; +static NSColor *BlueConfirm() { + return [NSColor colorWithSRGBRed:0 / 255.f green:130 / 255.f blue:215 / 255.f alpha:1.f]; } -@interface GameOptionsTouchBar : NSObject -{ +@interface GameOptionsTouchBar : NSObject { @public - metaforce::CStringTable* _pauseScreenStrg; - metaforce::CGameOptionsTouchBar::EAction _action; - std::pair _selection; - int _value, _pendingValue; + metaforce::CStringTable *_pauseScreenStrg; + metaforce::CGameOptionsTouchBar::EAction _action; + std::pair _selection; + int _value, _pendingValue; } --(IBAction)onBack:(id)sender; --(IBAction)onSlide:(id)sender; --(IBAction)onSet0:(id)sender; --(IBAction)onSet1:(id)sender; --(IBAction)onSet2:(id)sender; --(IBAction)onLeft:(id)sender; --(IBAction)onRight:(id)sender; +- (IBAction)onBack:(id)sender; +- (IBAction)onSlide:(id)sender; +- (IBAction)onSet0:(id)sender; +- (IBAction)onSet1:(id)sender; +- (IBAction)onSet2:(id)sender; +- (IBAction)onLeft:(id)sender; +- (IBAction)onRight:(id)sender; @end @implementation GameOptionsTouchBar -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"optionsGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"optionsGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"optionsGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"optionsGroup"]; + id items; + if (_selection.first == -1) { + items = [NSMutableArray arrayWithCapacity:5]; + [items addObject:@"back"]; + for (int i = 0; i < 4; ++i) + [items addObject:[NSString stringWithFormat:@"left/%d", i]]; + } else if (_selection.second == -1) { + const std::pair &opt = metaforce::GameOptionsRegistry[_selection.first]; + items = [NSMutableArray arrayWithCapacity:opt.first + 1]; + [items addObject:@"back"]; + for (int i = 0; i < opt.first; ++i) + [items addObject:[NSString stringWithFormat:@"right/%d", i]]; + } else { + const std::pair &opt = metaforce::GameOptionsRegistry[_selection.first]; + const metaforce::SGameOption &subopt = opt.second[_selection.second]; + if (subopt.type == metaforce::EOptionType::Float) + items = @[ @"back", @"value" ]; + else if (subopt.type == metaforce::EOptionType::DoubleEnum) + items = @[ @"back", @"label", @"double0", @"double1" ]; + else if (subopt.type == metaforce::EOptionType::TripleEnum) + items = @[ @"back", @"label", @"triple0", @"triple1", @"triple2" ]; + } touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"optionsGroup"; - return touchBar; -} --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"optionsGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items; - if (_selection.first == -1) - { - items = [NSMutableArray arrayWithCapacity:5]; - [items addObject:@"back"]; - for (int i=0 ; i<4 ; ++i) - [items addObject:[NSString stringWithFormat:@"left/%d", i]]; - } - else if (_selection.second == -1) - { - const std::pair& opt = metaforce::GameOptionsRegistry[_selection.first]; - items = [NSMutableArray arrayWithCapacity:opt.first+1]; - [items addObject:@"back"]; - for (int i=0 ; i& opt = metaforce::GameOptionsRegistry[_selection.first]; - const metaforce::SGameOption& subopt = opt.second[_selection.second]; - if (subopt.type == metaforce::EOptionType::Float) - items = @[@"back", @"value"]; - else if (subopt.type == metaforce::EOptionType::DoubleEnum) - items = @[@"back", @"label", @"double0", @"double1"]; - else if (subopt.type == metaforce::EOptionType::TripleEnum) - items = @[@"back", @"label", @"triple0", @"triple1", @"triple2"]; - } - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"back"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] - target:self action:@selector(onBack:)]; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"back"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] + target:self + action:@selector(onBack:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"label"]) { + const std::pair &opt = metaforce::GameOptionsRegistry[_selection.first]; + const metaforce::SGameOption &subopt = opt.second[_selection.second]; + + const char16_t *cStr = _pauseScreenStrg->GetString(subopt.stringId); + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSTextField *label = [NSTextField labelWithString:[str stringByAppendingString:@":"]]; + item.view = label; + return item; + } else if ([identifier isEqualToString:@"value"]) { + const std::pair &opt = metaforce::GameOptionsRegistry[_selection.first]; + const metaforce::SGameOption &subopt = opt.second[_selection.second]; + + const char16_t *cStr = _pauseScreenStrg->GetString(subopt.stringId); + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSSliderTouchBarItem *item = [[NSSliderTouchBarItem alloc] initWithIdentifier:identifier]; + NSSlider *slider = [NSSlider sliderWithValue:_value + minValue:subopt.minVal + maxValue:subopt.maxVal + target:nil + action:nil]; + item.target = self; + item.action = @selector(onSlide:); + item.slider = slider; + item.label = str; + return item; + } else if ([identifier isEqualToString:@"double0"]) { + const char16_t *cStr = _pauseScreenStrg->GetString(95); // Off + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onSet0:)]; + if (_value == 0) + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"double1"]) { + const char16_t *cStr = _pauseScreenStrg->GetString(94); // On + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onSet1:)]; + if (_value == 1) + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"triple0"]) { + const char16_t *cStr = _pauseScreenStrg->GetString(96); // Mono + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onSet0:)]; + if (_value == 0) + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"triple1"]) { + const char16_t *cStr = _pauseScreenStrg->GetString(97); // Stereo + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onSet1:)]; + if (_value == 1) + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"triple2"]) { + const char16_t *cStr = _pauseScreenStrg->GetString(98); // Dolby + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onSet2:)]; + if (_value == 2) + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else { + NSArray *pc = [identifier pathComponents]; + if ([pc count] == 2) { + NSString *first = [pc objectAtIndex:0]; + if ([first isEqualToString:@"left"]) { + auto idx = strtoul([[pc objectAtIndex:1] UTF8String], nullptr, 10); + const char16_t *cStr = _pauseScreenStrg->GetString(16 + idx); + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; + + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onLeft:)]; + button.tag = idx; item.view = button; return item; - } - else if ([identifier isEqualToString:@"label"]) - { - const std::pair& opt = metaforce::GameOptionsRegistry[_selection.first]; - const metaforce::SGameOption& subopt = opt.second[_selection.second]; + } else if ([first isEqualToString:@"right"]) { + const std::pair &opt = metaforce::GameOptionsRegistry[_selection.first]; + auto idx = strtoul([[pc objectAtIndex:1] UTF8String], nullptr, 10); + const metaforce::SGameOption &subopt = opt.second[idx]; + const char16_t *cStr = _pauseScreenStrg->GetString(subopt.stringId); + NSString *str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - const char16_t* cStr = _pauseScreenStrg->GetString(subopt.stringId); - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSTextField* label = [NSTextField labelWithString:[str stringByAppendingString:@":"]]; - item.view = label; - return item; - } - else if ([identifier isEqualToString:@"value"]) - { - const std::pair& opt = metaforce::GameOptionsRegistry[_selection.first]; - const metaforce::SGameOption& subopt = opt.second[_selection.second]; - - const char16_t* cStr = _pauseScreenStrg->GetString(subopt.stringId); - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSSliderTouchBarItem* item = [[NSSliderTouchBarItem alloc] initWithIdentifier:identifier]; - NSSlider* slider = [NSSlider sliderWithValue:_value minValue:subopt.minVal maxValue:subopt.maxVal - target:nil action:nil]; - item.target = self; - item.action = @selector(onSlide:); - item.slider = slider; - item.label = str; - return item; - } - else if ([identifier isEqualToString:@"double0"]) - { - const char16_t* cStr = _pauseScreenStrg->GetString(95); // Off - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onSet0:)]; - if (_value == 0) - button.bezelColor = BlueConfirm(); + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:str target:self action:@selector(onRight:)]; + button.tag = idx; item.view = button; return item; + } } - else if ([identifier isEqualToString:@"double1"]) - { - const char16_t* cStr = _pauseScreenStrg->GetString(94); // On - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onSet1:)]; - if (_value == 1) - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"triple0"]) - { - const char16_t* cStr = _pauseScreenStrg->GetString(96); // Mono - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onSet0:)]; - if (_value == 0) - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"triple1"]) - { - const char16_t* cStr = _pauseScreenStrg->GetString(97); // Stereo - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onSet1:)]; - if (_value == 1) - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"triple2"]) - { - const char16_t* cStr = _pauseScreenStrg->GetString(98); // Dolby - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onSet2:)]; - if (_value == 2) - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else - { - NSArray* pc = [identifier pathComponents]; - if ([pc count] == 2) - { - NSString* first = [pc objectAtIndex:0]; - if ([first isEqualToString:@"left"]) - { - auto idx = strtoul([[pc objectAtIndex:1] UTF8String], nullptr, 10); - const char16_t* cStr = _pauseScreenStrg->GetString(16+idx); - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onLeft:)]; - button.tag = idx; - item.view = button; - return item; - } - else if ([first isEqualToString:@"right"]) - { - const std::pair& opt = metaforce::GameOptionsRegistry[_selection.first]; - auto idx = strtoul([[pc objectAtIndex:1] UTF8String], nullptr, 10); - const metaforce::SGameOption& subopt = opt.second[idx]; - const char16_t* cStr = _pauseScreenStrg->GetString(subopt.stringId); - NSString* str = [NSString stringWithUTF8String:hecl::Char16ToUTF8(cStr).c_str()]; - - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:str target:self action:@selector(onRight:)]; - button.tag = idx; - item.view = button; - return item; - } - } - } - return nil; + } + return nil; } --(IBAction)onBack:(id)sender -{ - _action = metaforce::CGameOptionsTouchBar::EAction::Back; +- (IBAction)onBack:(id)sender { + _action = metaforce::CGameOptionsTouchBar::EAction::Back; } --(IBAction)onSlide:(id)sender -{ - _pendingValue = [((NSSliderTouchBarItem*)sender).slider intValue]; - _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; +- (IBAction)onSlide:(id)sender { + _pendingValue = [((NSSliderTouchBarItem *)sender).slider intValue]; + _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; } --(IBAction)onSet0:(id)sender -{ - _pendingValue = 0; - _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; +- (IBAction)onSet0:(id)sender { + _pendingValue = 0; + _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; } --(IBAction)onSet1:(id)sender -{ - _pendingValue = 1; - _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; +- (IBAction)onSet1:(id)sender { + _pendingValue = 1; + _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; } --(IBAction)onSet2:(id)sender -{ - _pendingValue = 2; - _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; +- (IBAction)onSet2:(id)sender { + _pendingValue = 2; + _action = metaforce::CGameOptionsTouchBar::EAction::ValueChange; } --(IBAction)onLeft:(id)sender -{ - _selection.first = ((NSButton*)sender).tag; - _action = metaforce::CGameOptionsTouchBar::EAction::Advance; +- (IBAction)onLeft:(id)sender { + _selection.first = ((NSButton *)sender).tag; + _action = metaforce::CGameOptionsTouchBar::EAction::Advance; } --(IBAction)onRight:(id)sender -{ - _selection.second = ((NSButton*)sender).tag; - _action = metaforce::CGameOptionsTouchBar::EAction::Advance; +- (IBAction)onRight:(id)sender { + _selection.second = ((NSButton *)sender).tag; + _action = metaforce::CGameOptionsTouchBar::EAction::Advance; } @end -namespace metaforce -{ +namespace metaforce { + +class CGameOptionsTouchBarMac : public CGameOptionsTouchBar { + TLockedToken m_pauseScreen; + GameOptionsTouchBar *m_touchBar; + bool m_initialized = false; -class CGameOptionsTouchBarMac : public CGameOptionsTouchBar -{ - TLockedToken m_pauseScreen; - GameOptionsTouchBar* m_touchBar; - bool m_initialized = false; public: - CGameOptionsTouchBarMac() - { - m_pauseScreen = g_SimplePool->GetObj("STRG_PauseScreen"); - m_touchBar = [GameOptionsTouchBar new]; - m_touchBar->_pauseScreenStrg = m_pauseScreen.GetObj(); - m_touchBar->_selection = std::make_pair(-1, -1); - m_touchBar->_value = -1; - } - EAction PopAction() - { - if (m_touchBar->_action != EAction::None) - { - EAction action = m_touchBar->_action; - m_touchBar->_action = EAction::None; - return action; - } - return EAction::None; - } - void GetSelection(int& left, int& right, int& value) - { - left = m_touchBar->_selection.first; - right = m_touchBar->_selection.second; - value = m_touchBar->_pendingValue; - } - void SetSelection(int left, int right, int value) - { - if (m_initialized && - left == m_touchBar->_selection.first && - right == m_touchBar->_selection.second && - value == m_touchBar->_value) - return; - m_initialized = true; - m_touchBar->_selection = std::make_pair(left, right); - m_touchBar->_value = value; - g_Main->GetMainWindow()->setTouchBarProvider((__bridge_retained void*)m_touchBar); + CGameOptionsTouchBarMac() { + m_pauseScreen = g_SimplePool->GetObj("STRG_PauseScreen"); + m_touchBar = [GameOptionsTouchBar new]; + m_touchBar->_pauseScreenStrg = m_pauseScreen.GetObj(); + m_touchBar->_selection = std::make_pair(-1, -1); + m_touchBar->_value = -1; + } + EAction PopAction() { + if (m_touchBar->_action != EAction::None) { + EAction action = m_touchBar->_action; + m_touchBar->_action = EAction::None; + return action; } + return EAction::None; + } + void GetSelection(int &left, int &right, int &value) { + left = m_touchBar->_selection.first; + right = m_touchBar->_selection.second; + value = m_touchBar->_pendingValue; + } + void SetSelection(int left, int right, int value) { + if (m_initialized && left == m_touchBar->_selection.first && right == m_touchBar->_selection.second && + value == m_touchBar->_value) + return; + m_initialized = true; + m_touchBar->_selection = std::make_pair(left, right); + m_touchBar->_value = value; + g_Main->GetMainWindow()->setTouchBarProvider((__bridge_retained void *)m_touchBar); + } }; -std::unique_ptr NewGameOptionsTouchBar() -{ - return std::make_unique(); -} +std::unique_ptr NewGameOptionsTouchBar() { return std::make_unique(); } } diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index e92b1fdbe..c054f1ad5 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -81,7 +81,8 @@ CWorldState::CWorldState(CAssetId id) : x0_mlvlId(id), x4_areaId(0) { x14_layerState = std::make_shared(); } -CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld) : x0_mlvlId(mlvlId) { +CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld) +: x0_mlvlId(mlvlId) { x4_areaId = TAreaId(reader.ReadEncoded(32)); x10_desiredAreaAssetId = u32(reader.ReadEncoded(32)); x8_mailbox = std::make_shared(reader, saveWorld); diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index f2f4f78ac..f7df2fb4f 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -1,13 +1,13 @@ macro(runtime_add_list rel_path a_list) - unset(tmp_list) - foreach(path IN LISTS ${a_list}) - if(IS_ABSOLUTE ${path}) - list(APPEND tmp_list "${path}") - else() - list(APPEND tmp_list "${rel_path}/${path}") - endif() - endforeach(path) - set(${a_list} "${tmp_list}" PARENT_SCOPE) + unset(tmp_list) + foreach (path IN LISTS ${a_list}) + if (IS_ABSOLUTE ${path}) + list(APPEND tmp_list "${path}") + else () + list(APPEND tmp_list "${rel_path}/${path}") + endif () + endforeach (path) + set(${a_list} "${tmp_list}" PARENT_SCOPE) endmacro(runtime_add_list) add_subdirectory(Audio) @@ -22,116 +22,116 @@ add_subdirectory(GuiSys) add_subdirectory(Input) add_subdirectory(Particle) -if(WIN32) - list(APPEND PLAT_SRCS CMemoryCardSysWin.cpp) -elseif(APPLE) - list(APPEND PLAT_SRCS CMemoryCardSysOSX.cpp) -else() - list(APPEND PLAT_SRCS CMemoryCardSysNix.cpp) -endif() +if (WIN32) + list(APPEND PLAT_SRCS CMemoryCardSysWin.cpp) +elseif (APPLE) + list(APPEND PLAT_SRCS CMemoryCardSysOSX.cpp) +else () + list(APPEND PLAT_SRCS CMemoryCardSysNix.cpp) +endif () add_custom_command(OUTPUT TCastTo.hpp TCastTo.cpp DEPENDS MkCastTo.py - COMMAND python ARGS ${CMAKE_CURRENT_SOURCE_DIR}/MkCastTo.py - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating cast functions") + COMMAND python ARGS ${CMAKE_CURRENT_SOURCE_DIR}/MkCastTo.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating cast functions") add_subdirectory(MP1) add_subdirectory(MP2) add_subdirectory(MP3) -if(APPLE) - set_source_files_properties(MP1/CFrontEndUITouchBarMac.mm - MP1/CSaveGameScreenTouchBarMac.mm - CGameOptionsTouchBarMac.mm - PROPERTIES COMPILE_FLAGS -fobjc-arc) - bintoc(startButton.cpp Resources/startButton@2x.png START_BUTTON_2X) - list(APPEND PLAT_SRCS startButton.cpp CGameOptionsTouchBarMac.mm) -endif() +if (APPLE) + set_source_files_properties(MP1/CFrontEndUITouchBarMac.mm + MP1/CSaveGameScreenTouchBarMac.mm + CGameOptionsTouchBarMac.mm + PROPERTIES COMPILE_FLAGS -fobjc-arc) + bintoc(startButton.cpp Resources/startButton@2x.png START_BUTTON_2X) + list(APPEND PLAT_SRCS startButton.cpp CGameOptionsTouchBarMac.mm) +endif () set(CAST_TO_SOURCES - MkCastTo.py - TCastTo.hpp TCastTo.cpp) + MkCastTo.py + TCastTo.hpp TCastTo.cpp) set(RUNTIME_SOURCES_A - RetroTypes.hpp RetroTypes.cpp - ${CAST_TO_SOURCES} - ${MP1_SOURCES} - ${AUDIO_SOURCES} - ${AUTOMAPPER_SOURCES} - ${CAMERA_SOURCES} - ${CHARACTER_SOURCES} - ${COLLISION_SOURCES} - ${GRAPHICS_SOURCES}) + RetroTypes.hpp RetroTypes.cpp + ${CAST_TO_SOURCES} + ${MP1_SOURCES} + ${AUDIO_SOURCES} + ${AUTOMAPPER_SOURCES} + ${CAMERA_SOURCES} + ${CHARACTER_SOURCES} + ${COLLISION_SOURCES} + ${GRAPHICS_SOURCES}) set(RUNTIME_SOURCES_B - ${CAST_TO_SOURCES} - ${GUISYS_SOURCES} - ${INPUT_SOURCES} - ${PARTICLE_SOURCES} - ${WORLD_SOURCES} - ${WEAPON_SOURCES} - ITweak.hpp - IMain.hpp - CStopwatch.hpp - CGameAllocator.hpp CGameAllocator.cpp - CMemoryCardSys.hpp CMemoryCardSys.cpp - CScannableObjectInfo.hpp CScannableObjectInfo.cpp + ${CAST_TO_SOURCES} + ${GUISYS_SOURCES} + ${INPUT_SOURCES} + ${PARTICLE_SOURCES} + ${WORLD_SOURCES} + ${WEAPON_SOURCES} + ITweak.hpp + IMain.hpp + CStopwatch.hpp + CGameAllocator.hpp CGameAllocator.cpp + CMemoryCardSys.hpp CMemoryCardSys.cpp + CScannableObjectInfo.hpp CScannableObjectInfo.cpp CWorldSaveGameInfo.hpp CWorldSaveGameInfo.cpp - CDependencyGroup.hpp CDependencyGroup.cpp - CBasics.hpp CBasicsPC.cpp - CIOWin.hpp - CIOWinManager.hpp CIOWinManager.cpp - CStateManager.hpp CStateManager.cpp - CGameState.hpp CGameState.cpp + CDependencyGroup.hpp CDependencyGroup.cpp + CBasics.hpp CBasicsPC.cpp + CIOWin.hpp + CIOWinManager.hpp CIOWinManager.cpp + CStateManager.hpp CStateManager.cpp + CGameState.hpp CGameState.cpp CScriptMailbox.hpp CScriptMailbox.cpp - CPlayerState.hpp CPlayerState.cpp - CRandom16.hpp CRandom16.cpp - CResFactory.hpp CResFactory.cpp - CResLoader.hpp CResLoader.cpp - CDvdRequest.hpp - CDvdFile.hpp CDvdFile.cpp - IObjectStore.hpp - CSimplePool.hpp CSimplePool.cpp - CGameOptions.hpp CGameOptions.cpp - CGameOptionsTouchBar.hpp CGameOptionsTouchBar.cpp - CStaticInterference.hpp CStaticInterference.cpp - CCRC32.hpp CCRC32.cpp - IFactory.hpp - IObjFactory.hpp - CObjectList.hpp CObjectList.cpp - GameObjectLists.hpp GameObjectLists.cpp - CSortedLists.hpp CSortedLists.cpp - CArchitectureMessage.hpp - CArchitectureQueue.hpp - IObj.hpp - IVParamObj.hpp - CTimeProvider.hpp CTimeProvider.cpp - CToken.hpp CToken.cpp - CFactoryMgr.hpp CFactoryMgr.cpp - CPakFile.hpp CPakFile.cpp - CStringExtras.hpp - IOStreams.hpp IOStreams.cpp - CMainFlowBase.hpp CMainFlowBase.cpp - CMFGameBase.hpp - CInGameTweakManagerBase.hpp - CGameDebug.hpp - CGameHintInfo.hpp CGameHintInfo.cpp - rstl.hpp - GameGlobalObjects.hpp GameGlobalObjects.cpp - GCNTypes.hpp - CTextureCache.hpp CTextureCache.cpp - CMayaSpline.hpp CMayaSpline.cpp - ${PLAT_SRCS}) + CPlayerState.hpp CPlayerState.cpp + CRandom16.hpp CRandom16.cpp + CResFactory.hpp CResFactory.cpp + CResLoader.hpp CResLoader.cpp + CDvdRequest.hpp + CDvdFile.hpp CDvdFile.cpp + IObjectStore.hpp + CSimplePool.hpp CSimplePool.cpp + CGameOptions.hpp CGameOptions.cpp + CGameOptionsTouchBar.hpp CGameOptionsTouchBar.cpp + CStaticInterference.hpp CStaticInterference.cpp + CCRC32.hpp CCRC32.cpp + IFactory.hpp + IObjFactory.hpp + CObjectList.hpp CObjectList.cpp + GameObjectLists.hpp GameObjectLists.cpp + CSortedLists.hpp CSortedLists.cpp + CArchitectureMessage.hpp + CArchitectureQueue.hpp + IObj.hpp + IVParamObj.hpp + CTimeProvider.hpp CTimeProvider.cpp + CToken.hpp CToken.cpp + CFactoryMgr.hpp CFactoryMgr.cpp + CPakFile.hpp CPakFile.cpp + CStringExtras.hpp + IOStreams.hpp IOStreams.cpp + CMainFlowBase.hpp CMainFlowBase.cpp + CMFGameBase.hpp + CInGameTweakManagerBase.hpp + CGameDebug.hpp + CGameHintInfo.hpp CGameHintInfo.cpp + rstl.hpp + GameGlobalObjects.hpp GameGlobalObjects.cpp + GCNTypes.hpp + CTextureCache.hpp CTextureCache.cpp + CMayaSpline.hpp CMayaSpline.cpp + ${PLAT_SRCS}) function(add_runtime_common_library name) -add_library(${name} ${ARGN}) -if(COMMAND add_sanitizers) - add_sanitizers(${name}) -endif() + add_library(${name} ${ARGN}) + if (COMMAND add_sanitizers) + add_sanitizers(${name}) + endif () -if(WINDOWS_STORE) - set_property(TARGET ${name} PROPERTY VS_WINRT_COMPONENT TRUE) -endif() + if (WINDOWS_STORE) + set_property(TARGET ${name} PROPERTY VS_WINRT_COMPONENT TRUE) + endif () endfunction() set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) @@ -146,78 +146,78 @@ add_runtime_common_library(RuntimeCommonB ${RUNTIME_SOURCES_B}) target_include_directories(RuntimeCommonB PUBLIC ${RUNTIME_INCLUDES}) target_link_libraries(RuntimeCommonB PUBLIC ${RUNTIME_LIBRARIES}) -if(WIN32) - configure_file(platforms/win/metaforce.rc.in "${CMAKE_CURRENT_SOURCE_DIR}/platforms/win/metaforce.rc" @ONLY) - set(PLAT_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/platforms/win/metaforce.rc" platforms/win/metaforce.manifest) - if(WINDOWS_STORE) - set(UWP_ASSETS - platforms/win/Assets/LargeTile.scale-100.png - platforms/win/Assets/LargeTile.scale-125.png - platforms/win/Assets/LargeTile.scale-150.png - platforms/win/Assets/LargeTile.scale-200.png - platforms/win/Assets/LargeTile.scale-400.png - platforms/win/Assets/SmallTile.scale-100.png - platforms/win/Assets/SmallTile.scale-125.png - platforms/win/Assets/SmallTile.scale-150.png - platforms/win/Assets/SmallTile.scale-200.png - platforms/win/Assets/SmallTile.scale-400.png - platforms/win/Assets/SplashScreen.scale-100.png - platforms/win/Assets/SplashScreen.scale-125.png - platforms/win/Assets/SplashScreen.scale-150.png - platforms/win/Assets/SplashScreen.scale-200.png - platforms/win/Assets/SplashScreen.scale-400.png - platforms/win/Assets/Square44x44Logo.scale-100.png - platforms/win/Assets/Square44x44Logo.scale-125.png - platforms/win/Assets/Square44x44Logo.scale-150.png - platforms/win/Assets/Square44x44Logo.scale-200.png - platforms/win/Assets/Square44x44Logo.scale-400.png - platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-16.png - platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-24.png - platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-32.png - platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-48.png - platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-256.png - platforms/win/Assets/Square150x150Logo.scale-100.png - platforms/win/Assets/Square150x150Logo.scale-125.png - platforms/win/Assets/Square150x150Logo.scale-150.png - platforms/win/Assets/Square150x150Logo.scale-200.png - platforms/win/Assets/Square150x150Logo.scale-400.png - platforms/win/Assets/metaforce.scale-100.png - platforms/win/Assets/metaforce.scale-125.png - platforms/win/Assets/metaforce.scale-150.png - platforms/win/Assets/metaforce.scale-200.png - platforms/win/Assets/metaforce.scale-400.png - platforms/win/Assets/WideTile.scale-100.png - platforms/win/Assets/WideTile.scale-125.png - platforms/win/Assets/WideTile.scale-150.png - platforms/win/Assets/WideTile.scale-200.png - platforms/win/Assets/WideTile.scale-400.png) - set_property(SOURCE platforms/win/Package.appxmanifest PROPERTY VS_DEPLOYMENT_CONTENT 1) - set_property(SOURCE ${UWP_ASSETS} PROPERTY VS_DEPLOYMENT_CONTENT 1) - set_property(SOURCE ${UWP_ASSETS} PROPERTY VS_DEPLOYMENT_LOCATION "Assets") - list(APPEND PLAT_SRCS ${UWP_ASSETS} platforms/win/Package.appxmanifest) - endif() -elseif(APPLE) - # nothing -elseif(UNIX) - add_subdirectory(platforms/freedesktop) - declare_wmicon_target() - set(PLAT_SRCS mainicon_netwm.cpp) - set(PLAT_LIBS rt) -endif() +if (WIN32) + configure_file(platforms/win/metaforce.rc.in "${CMAKE_CURRENT_SOURCE_DIR}/platforms/win/metaforce.rc" @ONLY) + set(PLAT_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/platforms/win/metaforce.rc" platforms/win/metaforce.manifest) + if (WINDOWS_STORE) + set(UWP_ASSETS + platforms/win/Assets/LargeTile.scale-100.png + platforms/win/Assets/LargeTile.scale-125.png + platforms/win/Assets/LargeTile.scale-150.png + platforms/win/Assets/LargeTile.scale-200.png + platforms/win/Assets/LargeTile.scale-400.png + platforms/win/Assets/SmallTile.scale-100.png + platforms/win/Assets/SmallTile.scale-125.png + platforms/win/Assets/SmallTile.scale-150.png + platforms/win/Assets/SmallTile.scale-200.png + platforms/win/Assets/SmallTile.scale-400.png + platforms/win/Assets/SplashScreen.scale-100.png + platforms/win/Assets/SplashScreen.scale-125.png + platforms/win/Assets/SplashScreen.scale-150.png + platforms/win/Assets/SplashScreen.scale-200.png + platforms/win/Assets/SplashScreen.scale-400.png + platforms/win/Assets/Square44x44Logo.scale-100.png + platforms/win/Assets/Square44x44Logo.scale-125.png + platforms/win/Assets/Square44x44Logo.scale-150.png + platforms/win/Assets/Square44x44Logo.scale-200.png + platforms/win/Assets/Square44x44Logo.scale-400.png + platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-16.png + platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-24.png + platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-32.png + platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-48.png + platforms/win/Assets/Square44x44Logo.altform-unplated_targetsize-256.png + platforms/win/Assets/Square150x150Logo.scale-100.png + platforms/win/Assets/Square150x150Logo.scale-125.png + platforms/win/Assets/Square150x150Logo.scale-150.png + platforms/win/Assets/Square150x150Logo.scale-200.png + platforms/win/Assets/Square150x150Logo.scale-400.png + platforms/win/Assets/metaforce.scale-100.png + platforms/win/Assets/metaforce.scale-125.png + platforms/win/Assets/metaforce.scale-150.png + platforms/win/Assets/metaforce.scale-200.png + platforms/win/Assets/metaforce.scale-400.png + platforms/win/Assets/WideTile.scale-100.png + platforms/win/Assets/WideTile.scale-125.png + platforms/win/Assets/WideTile.scale-150.png + platforms/win/Assets/WideTile.scale-200.png + platforms/win/Assets/WideTile.scale-400.png) + set_property(SOURCE platforms/win/Package.appxmanifest PROPERTY VS_DEPLOYMENT_CONTENT 1) + set_property(SOURCE ${UWP_ASSETS} PROPERTY VS_DEPLOYMENT_CONTENT 1) + set_property(SOURCE ${UWP_ASSETS} PROPERTY VS_DEPLOYMENT_LOCATION "Assets") + list(APPEND PLAT_SRCS ${UWP_ASSETS} platforms/win/Package.appxmanifest) + endif () +elseif (APPLE) + # nothing +elseif (UNIX) + add_subdirectory(platforms/freedesktop) + declare_wmicon_target() + set(PLAT_SRCS mainicon_netwm.cpp) + set(PLAT_LIBS rt) +endif () add_executable(metaforce CMain.cpp ${PLAT_SRCS} ImGuiConsole.hpp ImGuiConsole.cpp ImGuiEntitySupport.hpp ImGuiEntitySupport.cpp) # ImGuiPlayerLoadouts.hpp # target_atdna(metaforce atdna_ImGuiPlayerLoadouts.cpp ImGuiPlayerLoadouts.hpp) # RUNTIME_LIBRARIES repeated here for link ordering target_link_libraries(metaforce PUBLIC RuntimeCommon RuntimeCommonB ${RUNTIME_LIBRARIES} ${PLAT_LIBS}) -if(COMMAND add_sanitizers) - add_sanitizers(metaforce) -endif() +if (COMMAND add_sanitizers) + add_sanitizers(metaforce) +endif () if (NOT WINDOWS_STORE) - add_dependencies(metaforce visigen hecl) -else() - set_property(TARGET metaforce PROPERTY VS_WINRT_COMPONENT TRUE) - # This should match the Package.appxmanifest - set_property(TARGET metaforce PROPERTY VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "10.0.14393.0") -endif() + add_dependencies(metaforce visigen hecl) +else () + set_property(TARGET metaforce PROPERTY VS_WINRT_COMPONENT TRUE) + # This should match the Package.appxmanifest + set_property(TARGET metaforce PROPERTY VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "10.0.14393.0") +endif () diff --git a/Runtime/CMayaSpline.hpp b/Runtime/CMayaSpline.hpp index cb5ab0921..924924632 100644 --- a/Runtime/CMayaSpline.hpp +++ b/Runtime/CMayaSpline.hpp @@ -8,7 +8,6 @@ #include #include - namespace metaforce { class CMayaSplineKnot { float x0_time; diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp index ddbbb1a48..b50ef6e6b 100644 --- a/Runtime/CMemoryCardSys.cpp +++ b/Runtime/CMemoryCardSys.cpp @@ -578,7 +578,7 @@ bool CMemoryCardSys::CreateDolphinCard(kabufuda::ECardSlot slot) { } void CMemoryCardSys::_ResetCVar(kabufuda::ECardSlot slot) { - switch(slot) { + switch (slot) { case kabufuda::ECardSlot::SlotA: mc_dolphinAPath->fromLiteral(""); break; diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index 693dbba4a..beba822b7 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -26,8 +26,8 @@ class CSaveWorldMemory { u32 x8_areaCount; std::vector xc_areaIds; std::vector x1c_defaultLayerStates; - TLockedToken x2c_worldName; /* used to be optional */ - TLockedToken x3c_saveWorld; /* used to be optional */ + TLockedToken x2c_worldName; /* used to be optional */ + TLockedToken x3c_saveWorld; /* used to be optional */ public: CAssetId GetWorldNameId() const { return x0_strgId; } @@ -61,8 +61,8 @@ public: class CMemoryCardSys { TLockedToken x0_hints; - std::vector> xc_memoryWorlds; /* MLVL as key */ - std::optional> x1c_worldInter; /* used to be auto_ptr of vector */ + std::vector> xc_memoryWorlds; /* MLVL as key */ + std::optional> x1c_worldInter; /* used to be auto_ptr of vector */ std::vector> x20_scanStates; rstl::reserved_vector x30_scanCategoryCounts; @@ -92,10 +92,13 @@ public: using CardStat = kabufuda::CardStat; const std::vector& GetHints() const { return x0_hints->GetHints(); } const std::vector>& GetMemoryWorlds() const { return xc_memoryWorlds; } - const std::vector>& GetScanStates() const { return x20_scanStates; } + const std::vector>& GetScanStates() const { + return x20_scanStates; + } u32 GetScanCategoryCount(CWorldSaveGameInfo::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; } - std::vector>::const_iterator LookupScanState(CAssetId id) const { + std::vector>::const_iterator + LookupScanState(CAssetId id) const { return rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id, [](const std::pair& p) { return p.first; }); } diff --git a/Runtime/CObjectList.cpp b/Runtime/CObjectList.cpp index e4555d11d..f6d62d30e 100644 --- a/Runtime/CObjectList.cpp +++ b/Runtime/CObjectList.cpp @@ -13,7 +13,8 @@ void CObjectList::AddObject(CEntity& entity) { #ifndef NDEBUG if (x0_list[entity.GetUniqueId().Value()].entity != nullptr && x0_list[entity.GetUniqueId().Value()].entity != &entity) - Log.report(logvisor::Level::Fatal, FMT_STRING("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"), + Log.report(logvisor::Level::Fatal, + FMT_STRING("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"), entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value()); #endif s16 prevFirst = -1; diff --git a/Runtime/CPakFile.cpp b/Runtime/CPakFile.cpp index 4cb56c565..c0b91600b 100644 --- a/Runtime/CPakFile.cpp +++ b/Runtime/CPakFile.cpp @@ -7,7 +7,7 @@ CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, if (!CDvdFile::operator bool()) Log.report(logvisor::Fatal, FMT_STRING("{}: Unable to open"), GetPath()); x28_24_buildDepList = buildDepList; - //x28_24_buildDepList = true; // Always do this so metaforce can rapidly pre-warm shaders + // x28_24_buildDepList = true; // Always do this so metaforce can rapidly pre-warm shaders x28_26_worldPak = worldPak; m_override = override; } diff --git a/Runtime/CPakFile.hpp b/Runtime/CPakFile.hpp index b43ce88e5..a0804e076 100644 --- a/Runtime/CPakFile.hpp +++ b/Runtime/CPakFile.hpp @@ -63,7 +63,7 @@ private: void Warmup(); public: - CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override=false); + CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override = false); ~CPakFile(); const std::vector>& GetNameList() const { return x54_nameList; } const std::vector& GetDepList() const { return x64_depList; } diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index 5525988ad..2f263e1d6 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -74,9 +74,7 @@ constexpr std::array ComboAmmoPeriods{ }; } // Anonymous namespace -CPlayerState::CPlayerState() { - x24_powerups.resize(41); -} +CPlayerState::CPlayerState() { x24_powerups.resize(41); } CPlayerState::CPlayerState(CBitStreamReader& stream) { x4_enabledItems = u32(stream.ReadEncoded(32)); diff --git a/Runtime/CResLoader.hpp b/Runtime/CResLoader.hpp index 54fd1f681..17fdc0e0d 100644 --- a/Runtime/CResLoader.hpp +++ b/Runtime/CResLoader.hpp @@ -19,7 +19,8 @@ class CResLoader { // std::list> x0_aramList; std::list> x18_pakLoadedList; std::list> x30_pakLoadingList; - std::list> m_overridePakList; // URDE Addition, Trilogy has a similar mechanism, need to verify behavior against it + std::list> + m_overridePakList; // URDE Addition, Trilogy has a similar mechanism, need to verify behavior against it u32 x44_pakLoadingCount = 0; std::list>::iterator x48_curPak; mutable CAssetId x4c_cachedResId; @@ -28,11 +29,12 @@ class CResLoader { bool _GetTagListForFile(std::vector& out, const std::string& path, const std::unique_ptr& file) const; + public: CResLoader(); const std::vector* GetTagListForFile(std::string_view name) const; - void AddPakFileAsync(std::string_view name, bool buildDepList, bool worldPak, bool override=false); - void AddPakFile(std::string_view name, bool samusPak, bool worldPak, bool override=false); + void AddPakFileAsync(std::string_view name, bool buildDepList, bool worldPak, bool override = false); + void AddPakFile(std::string_view name, bool samusPak, bool worldPak, bool override = false); void WaitForPakFileLoadingComplete(); std::unique_ptr LoadNewResourcePartSync(const SObjectTag& tag, u32 length, u32 offset, void* extBuf); void LoadMemResourceSync(const SObjectTag& tag, std::unique_ptr& bufOut, int* sizeOut); diff --git a/Runtime/CScriptMailbox.cpp b/Runtime/CScriptMailbox.cpp index e22d8d0e7..2f6b10dde 100644 --- a/Runtime/CScriptMailbox.cpp +++ b/Runtime/CScriptMailbox.cpp @@ -19,8 +19,8 @@ CScriptMailbox::CScriptMailbox(CBitStreamReader& in, const CWorldSaveGameInfo& s for (u32 i = 0; i < relayCount; ++i) { if (!relayStates[i]) { continue; - } - x0_relays.push_back(saveWorld.GetRelayEditorId(i)); + } + x0_relays.push_back(saveWorld.GetRelayEditorId(i)); } } } diff --git a/Runtime/CSortedLists.cpp b/Runtime/CSortedLists.cpp index e3c6be061..e31a82322 100644 --- a/Runtime/CSortedLists.cpp +++ b/Runtime/CSortedLists.cpp @@ -233,9 +233,8 @@ s16 CSortedListManager::CalculateIntersections(ESortedList la, ESortedList lb, s return headId; } -void CSortedListManager::BuildNearList(EntityList& out, const zeus::CVector3f& pos, - const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, - const CActor* actor) { +void CSortedListManager::BuildNearList(EntityList& out, const zeus::CVector3f& pos, const zeus::CVector3f& dir, + float mag, const CMaterialFilter& filter, const CActor* actor) { if (mag == 0.f) { mag = 8000.f; } @@ -246,8 +245,7 @@ void CSortedListManager::BuildNearList(EntityList& out, const zeus::CVector3f& p BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor); } -void CSortedListManager::BuildNearList(EntityList& out, const CActor& actor, - const zeus::CAABox& aabb) { +void CSortedListManager::BuildNearList(EntityList& out, const CActor& actor, const zeus::CAABox& aabb) { const CMaterialFilter& filter = actor.GetMaterialFilter(); s16 id = ConstructIntersectionArray(aabb); while (id != -1) { @@ -262,8 +260,8 @@ void CSortedListManager::BuildNearList(EntityList& out, const CActor& actor, } } -void CSortedListManager::BuildNearList(EntityList& out, const zeus::CAABox& aabb, - const CMaterialFilter& filter, const CActor* actor) { +void CSortedListManager::BuildNearList(EntityList& out, const zeus::CAABox& aabb, const CMaterialFilter& filter, + const CActor* actor) { s16 id = ConstructIntersectionArray(aabb); while (id != -1) { SNode& node = AccessElement(x0_nodes, id); diff --git a/Runtime/CSortedLists.hpp b/Runtime/CSortedLists.hpp index c88cd8708..6d8f386a5 100644 --- a/Runtime/CSortedLists.hpp +++ b/Runtime/CSortedLists.hpp @@ -43,11 +43,10 @@ class CSortedListManager { public: CSortedListManager(); - void BuildNearList(EntityList& out, const zeus::CVector3f& pos, - const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor); - void BuildNearList(EntityList& out, const CActor& actor, const zeus::CAABox& aabb); - void BuildNearList(EntityList& out, const zeus::CAABox& aabb, + void BuildNearList(EntityList& out, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor); + void BuildNearList(EntityList& out, const CActor& actor, const zeus::CAABox& aabb); + void BuildNearList(EntityList& out, const zeus::CAABox& aabb, const CMaterialFilter& filter, const CActor* actor); void Remove(const CActor* actor); void Move(const CActor* actor, const zeus::CAABox& aabb); void Insert(const CActor* actor, const zeus::CAABox& aabb); diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index ab2c39b37..8f56ad6c2 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -62,8 +62,8 @@ hecl::CVar* debugToolDrawPlatformCollision = nullptr; hecl::CVar* sm_logScripting = nullptr; } // namespace logvisor::Module LogModule("metaforce::CStateManager"); -CStateManager::CStateManager(const std::weak_ptr& mailbox, - const std::weak_ptr& mwInfo, const std::weak_ptr& playerState, +CStateManager::CStateManager(const std::weak_ptr& mailbox, const std::weak_ptr& mwInfo, + const std::weak_ptr& playerState, const std::weak_ptr& wtMgr, const std::weak_ptr& layerState) : x8b8_playerState(playerState) @@ -1796,8 +1796,7 @@ void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& p } } -bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, - const EntityList& nearList) const { +bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, const EntityList& nearList) const { const CHealthInfo* hInfo = const_cast(damagee).HealthInfo(const_cast(*this)); if (hInfo == nullptr) { return false; @@ -1852,14 +1851,13 @@ bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CV } bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, - const EntityList& nearList, - const CMaterialFilter& filter, const CActor* damagee) const { + const EntityList& nearList, const CMaterialFilter& filter, + const CActor* damagee) const { return RayCollideWorldInternal(start, end, filter, nearList, damagee); } bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, - const CMaterialFilter& filter, - const EntityList& nearList, + const CMaterialFilter& filter, const EntityList& nearList, const CActor* damagee) const { const zeus::CVector3f delta = end - start; if (!delta.canBeNormalized()) { @@ -2681,19 +2679,17 @@ void CStateManager::AreaLoaded(TAreaId aid) { x880_envFxManager->AreaLoaded(); } -void CStateManager::BuildNearList(EntityList& listOut, const zeus::CVector3f& v1, - const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter, - const CActor* actor) const { +void CStateManager::BuildNearList(EntityList& listOut, const zeus::CVector3f& v1, const zeus::CVector3f& v2, float f1, + const CMaterialFilter& filter, const CActor* actor) const { x874_sortedListManager->BuildNearList(listOut, v1, v2, f1, filter, actor); } -void CStateManager::BuildColliderList(EntityList& listOut, const CActor& actor, - const zeus::CAABox& aabb) const { +void CStateManager::BuildColliderList(EntityList& listOut, const CActor& actor, const zeus::CAABox& aabb) const { x874_sortedListManager->BuildNearList(listOut, actor, aabb); } -void CStateManager::BuildNearList(EntityList& listOut, const zeus::CAABox& aabb, - const CMaterialFilter& filter, const CActor* actor) const { +void CStateManager::BuildNearList(EntityList& listOut, const zeus::CAABox& aabb, const CMaterialFilter& filter, + const CActor* actor) const { x874_sortedListManager->BuildNearList(listOut, aabb, filter, actor); } @@ -2799,8 +2795,7 @@ CRayCastResult CStateManager::RayStaticIntersection(const zeus::CVector3f& pos, CRayCastResult CStateManager::RayWorldIntersection(TUniqueId& idOut, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float length, - const CMaterialFilter& filter, - const EntityList& list) const { + const CMaterialFilter& filter, const EntityList& list) const { return CGameCollision::RayWorldIntersection(*this, idOut, pos, dir, length, filter, list); } @@ -2870,7 +2865,8 @@ std::pair CStateManager::CalculateScanCompletionRate() const { int idx = 0; for (const std::pair& scan : x8b8_playerState->GetScanTimes()) { const auto category = g_MemoryCardSys->GetScanStates()[idx++].second; - if (category != CWorldSaveGameInfo::EScanCategory::None && category != CWorldSaveGameInfo::EScanCategory::Research) { + if (category != CWorldSaveGameInfo::EScanCategory::None && + category != CWorldSaveGameInfo::EScanCategory::Research) { ++denom; if (scan.second == 1.f) { ++num; diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index b3b639055..7abe2e2c4 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -297,13 +297,11 @@ public: const CMaterialFilter&); void ProcessRadiusDamage(const CActor&, CActor&, TUniqueId senderId, const CDamageInfo& info, const CMaterialFilter&); void ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&, const CDamageInfo& info); - bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, - const EntityList& nearList) const; + bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, const EntityList& nearList) const; bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, const CMaterialFilter& filter, const CActor* damagee) const; - bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, - const EntityList& nearList, const CMaterialFilter& filter, - const CActor* damagee) const; + bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, const EntityList& nearList, + const CMaterialFilter& filter, const CActor* damagee) const; bool RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, const CMaterialFilter& filter, const EntityList& nearList, const CActor* damagee) const; bool MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter) const; @@ -344,11 +342,10 @@ public: void AreaUnloaded(TAreaId); void PrepareAreaUnload(TAreaId); void AreaLoaded(TAreaId); - void BuildNearList(EntityList& listOut, const zeus::CVector3f&, const zeus::CVector3f&, - float, const CMaterialFilter&, const CActor*) const; - void BuildColliderList(EntityList& listOut, const CActor&, const zeus::CAABox&) const; - void BuildNearList(EntityList& listOut, const zeus::CAABox&, const CMaterialFilter&, + void BuildNearList(EntityList& listOut, const zeus::CVector3f&, const zeus::CVector3f&, float, const CMaterialFilter&, const CActor*) const; + void BuildColliderList(EntityList& listOut, const CActor&, const zeus::CAABox&) const; + void BuildNearList(EntityList& listOut, const zeus::CAABox&, const CMaterialFilter&, const CActor*) const; void UpdateActorInSortedLists(CActor&); void UpdateSortedLists(); std::optional CalculateObjectBounds(const CActor&); @@ -357,8 +354,7 @@ public: CRayCastResult RayStaticIntersection(const zeus::CVector3f& pos, const zeus::CVector3f& dir, float length, const CMaterialFilter& filter) const; CRayCastResult RayWorldIntersection(TUniqueId& idOut, const zeus::CVector3f& pos, const zeus::CVector3f& dir, - float length, const CMaterialFilter& filter, - const EntityList& list) const; + float length, const CMaterialFilter& filter, const EntityList& list) const; void UpdateObjectInLists(CEntity&); TUniqueId AllocateUniqueId(); void DeferStateTransition(EStateManagerTransition t); diff --git a/Runtime/CStopwatch.hpp b/Runtime/CStopwatch.hpp index 50cb9653e..4e2b27675 100644 --- a/Runtime/CStopwatch.hpp +++ b/Runtime/CStopwatch.hpp @@ -10,19 +10,20 @@ class CStopwatch { public: CStopwatch() : m_start(std::chrono::steady_clock::now()) {} double report(const char* name) const { - double t = std::chrono::duration_cast( - std::chrono::steady_clock::now() - m_start).count() / 1000000.0; -//#ifndef NDEBUG -// fmt::print(FMT_STRING("{} {}\n"), name, t); -//#endif + double t = + std::chrono::duration_cast(std::chrono::steady_clock::now() - m_start).count() / + 1000000.0; + //#ifndef NDEBUG + // fmt::print(FMT_STRING("{} {}\n"), name, t); + //#endif return t; } double reportReset(const char* name) { std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); double t = std::chrono::duration_cast(now - m_start).count() / 1000000.0; -//#ifndef NDEBUG -// fmt::print(FMT_STRING("{} {}\n"), name, t); -//#endif + //#ifndef NDEBUG + // fmt::print(FMT_STRING("{} {}\n"), name, t); + //#endif m_start = now; return t; } diff --git a/Runtime/CStringExtras.hpp b/Runtime/CStringExtras.hpp index c7acb4091..96bb9ba3a 100644 --- a/Runtime/CStringExtras.hpp +++ b/Runtime/CStringExtras.hpp @@ -21,9 +21,8 @@ public: // another, this is a safe change to make. // static bool CompareCaseInsensitive(std::string_view a, std::string_view b) { - return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char lhs, char rhs) { - return std::tolower(lhs) == std::tolower(rhs); - }); + return std::equal(a.begin(), a.end(), b.begin(), b.end(), + [](char lhs, char rhs) { return std::tolower(lhs) == std::tolower(rhs); }); } static int IndexOfSubstring(std::string_view haystack, std::string_view needle) { diff --git a/Runtime/CTextureCache.cpp b/Runtime/CTextureCache.cpp index 34bc7c89a..77adda107 100644 --- a/Runtime/CTextureCache.cpp +++ b/Runtime/CTextureCache.cpp @@ -23,4 +23,4 @@ CFactoryFnReturn FTextureCacheFactory([[maybe_unused]] const SObjectTag& tag, CI [[maybe_unused]] CObjectReference* selfRef) { return TToken::GetIObjObjectFor(std::make_unique(in)); } -} \ No newline at end of file +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/CTextureCache.hpp b/Runtime/CTextureCache.hpp index 30acaef73..3f095172f 100644 --- a/Runtime/CTextureCache.hpp +++ b/Runtime/CTextureCache.hpp @@ -9,7 +9,7 @@ class CPaletteInfo { public: explicit CPaletteInfo(CInputStream& in) - : m_format(in.readUint32Big()), m_elementCount(in.readUint32Big()), m_dolphinHash(in.readUint64Big()) {} + : m_format(in.readUint32Big()), m_elementCount(in.readUint32Big()), m_dolphinHash(in.readUint64Big()) {} }; class CTextureInfo { ETexelFormat m_format; @@ -21,11 +21,11 @@ class CTextureInfo { public: explicit CTextureInfo(CInputStream& in) - : m_format(ETexelFormat(in.readUint32Big())) - , m_mipCount(in.readUint32Big()) - , m_width(in.readUint16Big()) - , m_height(in.readUint16Big()) - , m_dolphinHash(in.readUint64Big()) { + : m_format(ETexelFormat(in.readUint32Big())) + , m_mipCount(in.readUint32Big()) + , m_width(in.readUint16Big()) + , m_height(in.readUint16Big()) + , m_dolphinHash(in.readUint64Big()) { bool hasPal = in.readBool(); if (hasPal) m_paletteInfo.emplace(in); @@ -38,10 +38,9 @@ public: public: explicit CTextureCache(CInputStream& in); - const CTextureInfo* GetTextureInfo(CAssetId id) const; }; CFactoryFnReturn FTextureCacheFactory(const metaforce::SObjectTag& tag, CInputStream& in, const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef); -} \ No newline at end of file +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/CWorldSaveGameInfo.cpp b/Runtime/CWorldSaveGameInfo.cpp index 4779b97a0..dd0829d03 100644 --- a/Runtime/CWorldSaveGameInfo.cpp +++ b/Runtime/CWorldSaveGameInfo.cpp @@ -83,8 +83,8 @@ s32 CWorldSaveGameInfo::GetDoorIndex(const TEditorId& id) const { } CFactoryFnReturn FWorldSaveGameInfoFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in, - [[maybe_unused]] const CVParamTransfer& param, - [[maybe_unused]] CObjectReference* selfRef) { + [[maybe_unused]] const CVParamTransfer& param, + [[maybe_unused]] CObjectReference* selfRef) { return TToken::GetIObjObjectFor(std::make_unique(in)); } diff --git a/Runtime/CWorldSaveGameInfo.hpp b/Runtime/CWorldSaveGameInfo.hpp index 3f712b43b..e8f31f9d0 100644 --- a/Runtime/CWorldSaveGameInfo.hpp +++ b/Runtime/CWorldSaveGameInfo.hpp @@ -46,6 +46,6 @@ public: }; CFactoryFnReturn FWorldSaveGameInfoFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param, - CObjectReference* selfRef); + CObjectReference* selfRef); } // namespace metaforce diff --git a/Runtime/Camera/CBallCamera.cpp b/Runtime/Camera/CBallCamera.cpp index f0e3eb171..2ee35ba44 100644 --- a/Runtime/Camera/CBallCamera.cpp +++ b/Runtime/Camera/CBallCamera.cpp @@ -984,8 +984,8 @@ zeus::CVector3f CBallCamera::ApplyColliders() { } void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vector& colliderList, int& it, - int count, float tolerance, const EntityList& nearList, - float dt, CStateManager& mgr) { + int count, float tolerance, const EntityList& nearList, float dt, + CStateManager& mgr) { if (it < colliderList.size()) { x310_idealLookVec = {0.f, g_tweakBall->GetBallCameraOffset().y(), g_tweakPlayer->GetPlayerBallHalfExtent()}; x310_idealLookVec.y() *= x308_speedFactor; @@ -1032,8 +1032,7 @@ void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vector& colliderList, int& it, int count, - float tolerance, const EntityList& nearList, float dt, - CStateManager& mgr); - zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const EntityList& nearList, - float dt, CStateManager& mgr); - zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const EntityList& nearList, - float dt, CStateManager& mgr); + float tolerance, const EntityList& nearList, float dt, CStateManager& mgr); + zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const EntityList& nearList, float dt, CStateManager& mgr); + zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const EntityList& nearList, float dt, + CStateManager& mgr); zeus::CAABox CalculateCollidersBoundingBox(const std::vector& colliderList, CStateManager& mgr) const; [[nodiscard]] int CountObscuredColliders(const std::vector& colliderList) const; diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index 848bee6ab..3b132059b 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -58,8 +58,8 @@ int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) { float vol = zeus::clamp(100.f, std::max(data.GetMaxAMComponent(), data.GetMaxFMComponent()) * 9.f + 100.f, 127.f); CSfxHandle sfxHandle; if (data.xc0_flags & 0x1) - sfxHandle = CSfxManager::AddEmitter(SFXamb_x_rumble_lp_00, data.xc4_sfxPos, zeus::skZero3f, vol / 127.f, - false, false, 0x7f, kInvalidAreaId); + sfxHandle = CSfxManager::AddEmitter(SFXamb_x_rumble_lp_00, data.xc4_sfxPos, zeus::skZero3f, vol / 127.f, false, + false, 0x7f, kInvalidAreaId); else sfxHandle = CSfxManager::SfxStart(SFXamb_x_rumble_lp_00, vol / 127.f, 0.f, false, 0x7f, false, kInvalidAreaId); sfxHandle->SetTimeRemaining(data.x0_duration); @@ -631,11 +631,10 @@ void CCameraManager::SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId) { } float CCameraManager::GetCameraBobMagnitude() const { - return 1.f - zeus::clamp( - -1.f, - std::fabs(zeus::clamp(-1.f, x7c_fpCamera->GetTransform().basis[1].dot(zeus::skUp), 1.f)) / - std::cos(2.f * M_PIF / 12.f), - 1.f); + return 1.f - zeus::clamp(-1.f, + std::fabs(zeus::clamp(-1.f, x7c_fpCamera->GetTransform().basis[1].dot(zeus::skUp), 1.f)) / + std::cos(2.f * M_PIF / 12.f), + 1.f); } bool CCameraManager::HasBallCameraInitialPositionHint(CStateManager& mgr) const { @@ -699,7 +698,8 @@ void CCameraManager::AddActiveCameraHint(TUniqueId id, CStateManager& mgr) { if (const TCastToConstPtr hint = mgr.ObjectById(id)) { const auto search = std::find_if(x334_activeCameraHints.cbegin(), x334_activeCameraHints.cend(), [id](TUniqueId tid) { return tid == id; }); - if (search == x334_activeCameraHints.cend() && xac_cameraHints.size() != 64 && x334_activeCameraHints.size() != 64) { + if (search == x334_activeCameraHints.cend() && xac_cameraHints.size() != 64 && + x334_activeCameraHints.size() != 64) { x334_activeCameraHints.push_back(id); } } diff --git a/Runtime/Camera/CFirstPersonCamera.hpp b/Runtime/Camera/CFirstPersonCamera.hpp index b16638e57..4493ff24e 100644 --- a/Runtime/Camera/CFirstPersonCamera.hpp +++ b/Runtime/Camera/CFirstPersonCamera.hpp @@ -18,6 +18,7 @@ class CFirstPersonCamera : public CGameCamera { zeus::CVector3f x1c8_closeInVec; float x1d4_closeInTimer = 0.f; void _fovListener(hecl::CVar* cv); + public: DEFINE_ENTITY CFirstPersonCamera(TUniqueId, const zeus::CTransform& xf, TUniqueId, float orbitCameraSpeed, float fov, diff --git a/Runtime/Camera/CMakeLists.txt b/Runtime/Camera/CMakeLists.txt index 09042a348..0791a72b9 100644 --- a/Runtime/Camera/CMakeLists.txt +++ b/Runtime/Camera/CMakeLists.txt @@ -1,13 +1,13 @@ set(CAMERA_SOURCES - CCameraManager.hpp CCameraManager.cpp - CGameCamera.hpp CGameCamera.cpp - CFirstPersonCamera.hpp CFirstPersonCamera.cpp - CBallCamera.hpp CBallCamera.cpp - CInterpolationCamera.hpp CInterpolationCamera.cpp - CPathCamera.hpp CPathCamera.cpp - CCinematicCamera.hpp CCinematicCamera.cpp - CCameraShakeData.hpp CCameraShakeData.cpp - CCameraFilter.hpp CCameraFilter.cpp - CCameraSpline.hpp CCameraSpline.cpp) + CCameraManager.hpp CCameraManager.cpp + CGameCamera.hpp CGameCamera.cpp + CFirstPersonCamera.hpp CFirstPersonCamera.cpp + CBallCamera.hpp CBallCamera.cpp + CInterpolationCamera.hpp CInterpolationCamera.cpp + CPathCamera.hpp CPathCamera.cpp + CCinematicCamera.hpp CCinematicCamera.cpp + CCameraShakeData.hpp CCameraShakeData.cpp + CCameraFilter.hpp CCameraFilter.cpp + CCameraSpline.hpp CCameraSpline.cpp) runtime_add_list(Camera CAMERA_SOURCES) diff --git a/Runtime/Character/CActorLights.cpp b/Runtime/Character/CActorLights.cpp index f68695e80..815b3c8c5 100644 --- a/Runtime/Character/CActorLights.cpp +++ b/Runtime/Character/CActorLights.cpp @@ -292,8 +292,8 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea& zeus::CColor overflowAmbColor = zeus::skClear; /* Averaged light for overflow area lights */ - CLight overflowLight = CLight::BuildCustom(zeus::skZero3f, zeus::skZero3f, zeus::skBlack, - 0.f, 0.f, 0.f, 0.f, 0.f, 0.f); + CLight overflowLight = + CLight::BuildCustom(zeus::skZero3f, zeus::skZero3f, zeus::skBlack, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f); zeus::CColor overflowLightColor = zeus::skClear; float overflowMag = 0.f; diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 620541a0e..c7d6a01b5 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -561,9 +561,7 @@ void CAnimData::SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags, PoseSkinnedModel(model, x224_pose, drawFlags, morphEffect, morphMagnitudes); } -void CAnimData::DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags) { - model.Draw(flags); -} +void CAnimData::DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags) { model.Draw(flags); } void CAnimData::PreRender() { if (!x220_31_poseCached) { diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp index 71edfaaed..0e7bb21ac 100644 --- a/Runtime/Character/CAnimData.hpp +++ b/Runtime/Character/CAnimData.hpp @@ -196,8 +196,8 @@ public: std::shared_ptr GetAnimationManager() const; void RecalcPoseBuilder(const CCharAnimTime* time); void RenderAuxiliary(const zeus::CFrustum& frustum) const; - void Render(CSkinnedModel& model, const CModelFlags& drawFlags, - const std::optional& morphEffect, const float* morphMagnitudes); + void Render(CSkinnedModel& model, const CModelFlags& drawFlags, const std::optional& morphEffect, + const float* morphMagnitudes); void SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags, const std::optional& morphEffect, const float* morphMagnitudes); static void DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags); @@ -209,7 +209,8 @@ public: void GetAnimationPrimitives(const CAnimPlaybackParms& parms, std::set& primsOut) const; void SetAnimation(const CAnimPlaybackParms& parms, bool noTrans); SAdvancementDeltas DoAdvance(float dt, bool& suspendParticles, CRandom16& random, bool advTree); - SAdvancementDeltas Advance(float dt, const zeus::CVector3f& scale, CStateManager& stateMgr, TAreaId aid, bool advTree); + SAdvancementDeltas Advance(float dt, const zeus::CVector3f& scale, CStateManager& stateMgr, TAreaId aid, + bool advTree); SAdvancementDeltas AdvanceIgnoreParticles(float dt, CRandom16& random, bool advTree); void AdvanceAnim(CCharAnimTime& time, zeus::CVector3f& offset, zeus::CQuaternion& quat); void SetXRayModel(const TLockedToken& model, const TLockedToken& skinRules); @@ -220,8 +221,7 @@ public: const TLockedToken& GetModelData() const { return xd8_modelData; } static void PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose, const CModelFlags& drawFlags, - const std::optional& morphEffect, - const float* morphMagnitudes); + const std::optional& morphEffect, const float* morphMagnitudes); void AdvanceParticles(const zeus::CTransform& xf, float dt, const zeus::CVector3f&, CStateManager& stateMgr); float GetAverageVelocity(int animIn) const; void ResetPOILists(); diff --git a/Runtime/Character/CAnimSourceReader.hpp b/Runtime/Character/CAnimSourceReader.hpp index d955f7070..5ad1a281d 100644 --- a/Runtime/Character/CAnimSourceReader.hpp +++ b/Runtime/Character/CAnimSourceReader.hpp @@ -61,7 +61,8 @@ protected: public: CAnimSourceReaderBase(std::unique_ptr&& sourceInfo, const CCharAnimTime& time); - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeAnimReaderContainer.hpp b/Runtime/Character/CAnimTreeAnimReaderContainer.hpp index 4642eddf2..e5dad31c5 100644 --- a/Runtime/Character/CAnimTreeAnimReaderContainer.hpp +++ b/Runtime/Character/CAnimTreeAnimReaderContainer.hpp @@ -30,7 +30,8 @@ public: bool VHasOffset(const CSegId& seg) const override; zeus::CVector3f VGetOffset(const CSegId& seg) const override; zeus::CQuaternion VGetRotation(const CSegId& seg) const override; - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeDoubleChild.hpp b/Runtime/Character/CAnimTreeDoubleChild.hpp index b94dae770..07ab901c7 100644 --- a/Runtime/Character/CAnimTreeDoubleChild.hpp +++ b/Runtime/Character/CAnimTreeDoubleChild.hpp @@ -34,7 +34,8 @@ public: CAnimTreeDoubleChild(const std::weak_ptr& a, const std::weak_ptr& b, std::string_view name); SAdvancementResults VAdvanceView(const CCharAnimTime& a) override; - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeLoopIn.hpp b/Runtime/Character/CAnimTreeLoopIn.hpp index 82ff6b39f..362d1b7c5 100644 --- a/Runtime/Character/CAnimTreeLoopIn.hpp +++ b/Runtime/Character/CAnimTreeLoopIn.hpp @@ -30,7 +30,8 @@ public: std::optional> VSimplified() override; std::shared_ptr VGetBestUnblendedChild() const override; std::unique_ptr VClone() const override; - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeSequence.cpp b/Runtime/Character/CAnimTreeSequence.cpp index a964abc07..6623fb1b9 100644 --- a/Runtime/Character/CAnimTreeSequence.cpp +++ b/Runtime/Character/CAnimTreeSequence.cpp @@ -15,9 +15,9 @@ CAnimTreeSequence::CAnimTreeSequence(std::vector> seq , x94_curTime(0.f) {} CAnimTreeSequence::CAnimTreeSequence(const std::shared_ptr& curNode, - std::vector> metaAnims, - CAnimSysContext animSys, std::string_view name, - CSequenceFundamentals fundamentals, const CCharAnimTime& time) + std::vector> metaAnims, CAnimSysContext animSys, + std::string_view name, CSequenceFundamentals fundamentals, + const CCharAnimTime& time) : CAnimTreeSingleChild(curNode, name) , x18_animCtx(std::move(animSys)) , x28_sequence(std::move(metaAnims)) diff --git a/Runtime/Character/CAnimTreeSequence.hpp b/Runtime/Character/CAnimTreeSequence.hpp index f8a3c5ac6..b3a4164e1 100644 --- a/Runtime/Character/CAnimTreeSequence.hpp +++ b/Runtime/Character/CAnimTreeSequence.hpp @@ -32,7 +32,8 @@ public: SAdvancementResults VAdvanceView(const CCharAnimTime& dt) override; CCharAnimTime VGetTimeRemaining() const override; CSteadyStateAnimInfo VGetSteadyStateAnimInfo() const override; - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeSingleChild.hpp b/Runtime/Character/CAnimTreeSingleChild.hpp index 676865db2..df78f8d86 100644 --- a/Runtime/Character/CAnimTreeSingleChild.hpp +++ b/Runtime/Character/CAnimTreeSingleChild.hpp @@ -20,7 +20,8 @@ public: bool VHasOffset(const CSegId& seg) const override; zeus::CVector3f VGetOffset(const CSegId& seg) const override; zeus::CQuaternion VGetRotation(const CSegId& seg) const override; - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeTimeScale.cpp b/Runtime/Character/CAnimTreeTimeScale.cpp index 5403d8909..7c7281a64 100644 --- a/Runtime/Character/CAnimTreeTimeScale.cpp +++ b/Runtime/Character/CAnimTreeTimeScale.cpp @@ -127,8 +127,8 @@ CAnimTreeEffectiveContribution CAnimTreeTimeScale::VGetContributionOfHighestInfl std::shared_ptr CAnimTreeTimeScale::VGetBestUnblendedChild() const { if (std::shared_ptr bestChild = x14_child->VGetBestUnblendedChild()) { - auto newNode = std::make_shared(CAnimTreeNode::Cast(bestChild->Clone()), - x18_timeScale->Clone(), x28_targetAccelTime, x4_name); + auto newNode = std::make_shared(CAnimTreeNode::Cast(bestChild->Clone()), x18_timeScale->Clone(), + x28_targetAccelTime, x4_name); newNode->x20_curAccelTime = x20_curAccelTime; newNode->x30_initialTime = x30_initialTime; return {std::move(newNode)}; diff --git a/Runtime/Character/CAnimTreeTimeScale.hpp b/Runtime/Character/CAnimTreeTimeScale.hpp index 8ef1af663..e96ceedfc 100644 --- a/Runtime/Character/CAnimTreeTimeScale.hpp +++ b/Runtime/Character/CAnimTreeTimeScale.hpp @@ -27,7 +27,8 @@ public: void VSetPhase(float) override; std::optional> VSimplified() override; - size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override; + size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, + u32) const override; size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const override; size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, diff --git a/Runtime/Character/CAnimTreeTweenBase.hpp b/Runtime/Character/CAnimTreeTweenBase.hpp index 6880b4e99..03ab86cc4 100644 --- a/Runtime/Character/CAnimTreeTweenBase.hpp +++ b/Runtime/Character/CAnimTreeTweenBase.hpp @@ -36,9 +36,7 @@ public: zeus::CQuaternion VGetRotation(const CSegId& seg) const override; std::optional> VSimplified() override; - virtual std::optional> VReverseSimplified() { - return CAnimTreeTweenBase::VSimplified(); - } + virtual std::optional> VReverseSimplified() { return CAnimTreeTweenBase::VSimplified(); } static bool ShouldCullTree() { return 3 <= sAdvancementDepth; } static void IncAdvancementDepth() { sAdvancementDepth++; } diff --git a/Runtime/Character/CAssetFactory.cpp b/Runtime/Character/CAssetFactory.cpp index c78d94b1a..128051941 100644 --- a/Runtime/Character/CAssetFactory.cpp +++ b/Runtime/Character/CAssetFactory.cpp @@ -38,14 +38,14 @@ void CCharacterFactoryBuilder::CDummyFactory::EnumerateNamedResources( u32 CCharacterFactoryBuilder::CDummyFactory::ResourceSize(const metaforce::SObjectTag& tag) { return 0; } -std::shared_ptr CCharacterFactoryBuilder::CDummyFactory::LoadResourceAsync(const metaforce::SObjectTag& tag, - void* target) { +std::shared_ptr +CCharacterFactoryBuilder::CDummyFactory::LoadResourceAsync(const metaforce::SObjectTag& tag, void* target) { return {}; } -std::shared_ptr CCharacterFactoryBuilder::CDummyFactory::LoadResourcePartAsync(const metaforce::SObjectTag& tag, - u32 off, u32 size, - void* target) { +std::shared_ptr +CCharacterFactoryBuilder::CDummyFactory::LoadResourcePartAsync(const metaforce::SObjectTag& tag, u32 off, u32 size, + void* target) { return {}; } diff --git a/Runtime/Character/CBodyController.cpp b/Runtime/Character/CBodyController.cpp index f0bb979bf..db09f7e18 100644 --- a/Runtime/Character/CBodyController.cpp +++ b/Runtime/Character/CBodyController.cpp @@ -12,10 +12,7 @@ namespace metaforce { CBodyController::CBodyController(CActor& actor, float turnSpeed, EBodyType bodyType) -: x0_actor(actor) -, x2a4_bodyStateInfo(actor, bodyType) -, x2f4_bodyType(bodyType) -, x2fc_turnSpeed(turnSpeed) { +: x0_actor(actor), x2a4_bodyStateInfo(actor, bodyType), x2f4_bodyType(bodyType), x2fc_turnSpeed(turnSpeed) { x2a4_bodyStateInfo.x18_bodyController = this; } diff --git a/Runtime/Character/CBodyStateCmdMgr.hpp b/Runtime/Character/CBodyStateCmdMgr.hpp index 4949a77c3..dc795f8e7 100644 --- a/Runtime/Character/CBodyStateCmdMgr.hpp +++ b/Runtime/Character/CBodyStateCmdMgr.hpp @@ -265,7 +265,7 @@ public: constexpr explicit CBCLoopAttackCmd(pas::ELoopAttackType type, bool waitForAnimOver = false) : CBodyStateCmd(EBodyStateCmd::LoopAttack), x8_type(type), xc_waitForAnimOver(waitForAnimOver) {} constexpr pas::ELoopAttackType GetAttackType() const { return x8_type; } - constexpr bool WaitForAnimOver() const { return xc_waitForAnimOver ; } + constexpr bool WaitForAnimOver() const { return xc_waitForAnimOver; } }; class CBCTauntCmd : public CBodyStateCmd { diff --git a/Runtime/Character/CBodyStateInfo.cpp b/Runtime/Character/CBodyStateInfo.cpp index a74d8cd19..811fdc8f3 100644 --- a/Runtime/Character/CBodyStateInfo.cpp +++ b/Runtime/Character/CBodyStateInfo.cpp @@ -48,7 +48,8 @@ CBodyStateInfo::CBodyStateInfo(CActor& actor, EBodyType type) { x1c_additiveStates.emplace_back(pas::EAnimationState::AdditiveReaction, std::make_unique()); } -std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(pas::EAnimationState stateId, + CActor& actor) const { switch (stateId) { case pas::EAnimationState::Fall: return std::make_unique(); @@ -138,7 +139,8 @@ std::unique_ptr CBodyStateInfo::SetupNewFlyerBodyStates(pas::EAnimat } } -std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(pas::EAnimationState stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(pas::EAnimationState stateId, + CActor& actor) const { switch (stateId) { case pas::EAnimationState::Fall: return std::make_unique(); @@ -183,7 +185,8 @@ std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(pas::EAnim } } -std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(pas::EAnimationState stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(pas::EAnimationState stateId, + CActor& actor) const { switch (stateId) { case pas::EAnimationState::Fall: return std::make_unique(); @@ -273,7 +276,8 @@ std::unique_ptr CBodyStateInfo::SetupFlyerBodyStates(pas::EAnimation } } -std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(pas::EAnimationState stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(pas::EAnimationState stateId, + CActor& actor) const { switch (stateId) { case pas::EAnimationState::Fall: return std::make_unique(); diff --git a/Runtime/Character/CBoneTracking.cpp b/Runtime/Character/CBoneTracking.cpp index 4f4b560ed..544f6653c 100644 --- a/Runtime/Character/CBoneTracking.cpp +++ b/Runtime/Character/CBoneTracking.cpp @@ -10,8 +10,8 @@ namespace metaforce { -CBoneTracking::CBoneTracking(const CAnimData& animData, std::string_view bone, - float maxTrackingAngle, float angSpeed, EBoneTrackingFlags flags) +CBoneTracking::CBoneTracking(const CAnimData& animData, std::string_view bone, float maxTrackingAngle, float angSpeed, + EBoneTrackingFlags flags) : x14_segId(animData.GetCharLayoutInfo().GetSegIdFromString(bone)) , x1c_maxTrackingAngle(maxTrackingAngle) , x20_angSpeed(angSpeed) @@ -54,8 +54,10 @@ void CBoneTracking::PreRender(const CStateManager& mgr, CAnimData& animData, con } parentBoneXf.origin = pos * localOffsetScale; zeus::CTransform finalXf = worldXf * parentBoneXf; - zeus::CVector3f localDir = finalXf.transposeRotate( - (targetAct ? targetAct->GetAimPosition(mgr, 0.f) : *x24_targetPosition) - finalXf.origin).normalized(); + zeus::CVector3f localDir = + finalXf + .transposeRotate((targetAct ? targetAct->GetAimPosition(mgr, 0.f) : *x24_targetPosition) - finalXf.origin) + .normalized(); if (x36_28_noHorizontalAim) localDir = zeus::CVector3f(0.f, localDir.toVec2f().magnitude(), localDir.z()); if (x36_29_parentIk) { @@ -72,16 +74,16 @@ void CBoneTracking::PreRender(const CStateManager& mgr, CAnimData& animData, con float angle = zeus::CVector3f::getAngleDiff(x0_curRotation.transform(zeus::skForward), localDir); float clampedAngle = std::min(angle, x18_time * x20_angSpeed); if (clampedAngle > 1.0e-05f) { - x0_curRotation = zeus::CQuaternion::slerpShort(x0_curRotation, - zeus::CQuaternion::lookAt(zeus::skForward, zeus::CUnitVector3f(localDir), 2.f * M_PIF), - clampedAngle / angle); + x0_curRotation = zeus::CQuaternion::slerpShort( + x0_curRotation, zeus::CQuaternion::lookAt(zeus::skForward, zeus::CUnitVector3f(localDir), 2.f * M_PIF), + clampedAngle / angle); } pb.GetTreeMap()[x14_segId].x4_rotation = x0_curRotation; animData.MarkPoseDirty(); } else if (x36_25_hasTrackedRotation) { zeus::CQuaternion qb = pb.GetTreeMap()[x14_segId].x4_rotation; - float angle = zeus::CVector3f::getAngleDiff(x0_curRotation.transform(zeus::skForward), - qb.transform(zeus::skForward)); + float angle = + zeus::CVector3f::getAngleDiff(x0_curRotation.transform(zeus::skForward), qb.transform(zeus::skForward)); float maxAngDelta = x18_time * x20_angSpeed; float clampedAngle = std::min(angle, maxAngDelta); if (clampedAngle > 0.5f * maxAngDelta) { diff --git a/Runtime/Character/CBoneTracking.hpp b/Runtime/Character/CBoneTracking.hpp index 56693b2fc..9023c418d 100644 --- a/Runtime/Character/CBoneTracking.hpp +++ b/Runtime/Character/CBoneTracking.hpp @@ -15,13 +15,7 @@ class CAnimData; class CStateManager; class CBodyController; -enum class EBoneTrackingFlags { - None = 0, - NoParent = 1, - NoParentOrigin = 2, - NoHorizontalAim = 4, - ParentIk = 8 -}; +enum class EBoneTrackingFlags { None = 0, NoParent = 1, NoParentOrigin = 2, NoHorizontalAim = 4, ParentIk = 8 }; ENABLE_BITWISE_ENUM(EBoneTrackingFlags) class CBoneTracking { @@ -41,11 +35,11 @@ class CBoneTracking { bool x36_29_parentIk : 1; public: - CBoneTracking(const CAnimData& animData, std::string_view bone, - float maxTrackingAngle, float angSpeed, EBoneTrackingFlags flags); + CBoneTracking(const CAnimData& animData, std::string_view bone, float maxTrackingAngle, float angSpeed, + EBoneTrackingFlags flags); void Update(float dt); - void PreRender(const CStateManager& mgr, CAnimData& animData, const zeus::CTransform& xf, - const zeus::CVector3f& vec, const CBodyController& bodyController); + void PreRender(const CStateManager& mgr, CAnimData& animData, const zeus::CTransform& xf, const zeus::CVector3f& vec, + const CBodyController& bodyController); void PreRender(const CStateManager& mgr, CAnimData& animData, const zeus::CTransform& worldXf, const zeus::CVector3f& localOffsetScale, bool tracking); void SetActive(bool active); diff --git a/Runtime/Character/CCharacterFactory.cpp b/Runtime/Character/CCharacterFactory.cpp index 50aba8405..1469a8b7e 100644 --- a/Runtime/Character/CCharacterFactory.cpp +++ b/Runtime/Character/CCharacterFactory.cpp @@ -67,10 +67,12 @@ std::shared_ptr CCharacterFactory::CDummyFactory::LoadResourcePartA return {}; } -std::unique_ptr CCharacterFactory::CDummyFactory::LoadResourceSync(const metaforce::SObjectTag& tag) { return {}; } +std::unique_ptr CCharacterFactory::CDummyFactory::LoadResourceSync(const metaforce::SObjectTag& tag) { + return {}; +} -std::unique_ptr CCharacterFactory::CDummyFactory::LoadNewResourcePartSync(const metaforce::SObjectTag& tag, u32 off, - u32 size) { +std::unique_ptr CCharacterFactory::CDummyFactory::LoadNewResourcePartSync(const metaforce::SObjectTag& tag, + u32 off, u32 size) { return {}; } diff --git a/Runtime/Character/CFBStreamedAnimReader.hpp b/Runtime/Character/CFBStreamedAnimReader.hpp index 39a394876..5e56a102e 100644 --- a/Runtime/Character/CFBStreamedAnimReader.hpp +++ b/Runtime/Character/CFBStreamedAnimReader.hpp @@ -85,7 +85,7 @@ public: }; class CSegIdToIndexConverter { - std::array x0_indices; + std::array x0_indices; public: explicit CSegIdToIndexConverter(const CFBStreamedAnimReaderTotals& totals); diff --git a/Runtime/Character/CGroundMovement.cpp b/Runtime/Character/CGroundMovement.cpp index ec0f5e952..1b1c8eec7 100644 --- a/Runtime/Character/CGroundMovement.cpp +++ b/Runtime/Character/CGroundMovement.cpp @@ -114,8 +114,8 @@ void CGroundMovement::MoveGroundCollider(CStateManager& mgr, CPhysicsActor& acto } bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, - const CMaterialFilter& filter, EntityList& nearList, - float stepUp, float stepDown, float& fOut, CCollisionInfoList& list) { + const CMaterialFilter& filter, EntityList& nearList, float stepUp, float stepDown, + float& fOut, CCollisionInfoList& list) { float zextent = stepDown; if (list.GetCount() <= 0) { return true; @@ -177,9 +177,8 @@ bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& m } bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, - const CMaterialFilter& filter, - EntityList& nearList, float amt, float& resolved, - CCollisionInfoList& list, TUniqueId& idOut) { + const CMaterialFilter& filter, EntityList& nearList, float amt, + float& resolved, CCollisionInfoList& list, TUniqueId& idOut) { actor.MoveCollisionPrimitive({0.f, 0.f, amt}); zeus::CAABox aabb = zeus::CAABox(); @@ -237,8 +236,7 @@ bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateMana } void CGroundMovement::MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, - const CMaterialFilter& filter, - EntityList& nearList, float dt) { + const CMaterialFilter& filter, EntityList& nearList, float dt) { bool didCollide = false; bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player); float remDt = dt; @@ -638,9 +636,8 @@ static bool RemovePositiveZComponentFromNormal(zeus::CVector3f& vec) { } CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float dt, - EntityList& nearList, - CAreaCollisionCache& cache, const SMovementOptions& opts, - SMoveObjectResult& result) { + EntityList& nearList, CAreaCollisionCache& cache, + const SMovementOptions& opts, SMoveObjectResult& result) { result.x6c_processedCollisions = 0; CMaterialList ret; zeus::CVector3f floorPlaneNormal = opts.x3c_floorPlaneNormal ? *opts.x3c_floorPlaneNormal : zeus::skZero3f; diff --git a/Runtime/Character/CGroundMovement.hpp b/Runtime/Character/CGroundMovement.hpp index d38ac434f..bd701d2be 100644 --- a/Runtime/Character/CGroundMovement.hpp +++ b/Runtime/Character/CGroundMovement.hpp @@ -46,25 +46,21 @@ public: }; static void CheckFalling(CPhysicsActor& actor, CStateManager& mgr, float); - static void MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt, - const EntityList* nearList); + static void MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt, const EntityList* nearList); static bool ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, - const CMaterialFilter& filter, EntityList& nearList, float, - float, float&, CCollisionInfoList& list); + const CMaterialFilter& filter, EntityList& nearList, float, float, float&, + CCollisionInfoList& list); static bool MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, - const CMaterialFilter& filter, EntityList& nearList, - float, float&, CCollisionInfoList& list, TUniqueId& idOut); + const CMaterialFilter& filter, EntityList& nearList, float, float&, + CCollisionInfoList& list, TUniqueId& idOut); static void MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, - const CMaterialFilter& filter, EntityList& nearList, - float); + const CMaterialFilter& filter, EntityList& nearList, float); static zeus::CVector3f CollisionDamping(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c, float d, float e); - static void MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float, - const EntityList* nearList); + static void MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float, const EntityList* nearList); static bool RemoveNormalComponent(const zeus::CVector3f&, const zeus::CVector3f&, zeus::CVector3f&, float&); static bool RemoveNormalComponent(const zeus::CVector3f& a, zeus::CVector3f& b); - static CMaterialList MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float, - EntityList& nearList, + static CMaterialList MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float, EntityList& nearList, CAreaCollisionCache& cache, const SMovementOptions& opts, SMoveObjectResult& result); }; diff --git a/Runtime/Character/CIkChain.cpp b/Runtime/Character/CIkChain.cpp index a0adb83b0..0a6915cb5 100644 --- a/Runtime/Character/CIkChain.cpp +++ b/Runtime/Character/CIkChain.cpp @@ -44,7 +44,7 @@ void CIkChain::PreRender(CAnimData& animData, const zeus::CTransform& xf, const zeus::CQuaternion newP1Rot = p1Rot; Solve(newP2Rot, newP1Rot, localDelta); zeus::CQuaternion newBoneRot = - (zeus::CQuaternion((xf * p2Xf).basis) * p2Rot.inverse() * newP2Rot * newP1Rot).inverse() * x24_holdRot; + (zeus::CQuaternion((xf * p2Xf).basis) * p2Rot.inverse() * newP2Rot * newP1Rot).inverse() * x24_holdRot; if (x40_time < 1.f) { newP2Rot = zeus::CQuaternion::slerpShort(p2Rot, newP2Rot, x40_time); newP1Rot = zeus::CQuaternion::slerpShort(p1Rot, newP1Rot, x40_time); @@ -61,10 +61,15 @@ void CIkChain::Solve(zeus::CQuaternion& q1, zeus::CQuaternion& q2, const zeus::C const float mag = vec.magnitude(); const float magSq = mag * mag; const float twoMag = (2.0f * mag); - float f29 = std::acos(zeus::clamp(-1.f, (((x20_p1BoneLength * magSq) + x20_p1BoneLength) - - (x1c_p2p1Length * x1c_p2p1Length)) / (twoMag * x20_p1BoneLength), 1.f)); - float f30 = std::acos(zeus::clamp(-1.f, ((x1c_p2p1Length * (magSq - (x20_p1BoneLength * x20_p1BoneLength))) + - x1c_p2p1Length) / (twoMag * x1c_p2p1Length), 1.f)); + float f29 = + std::acos(zeus::clamp(-1.f, + (((x20_p1BoneLength * magSq) + x20_p1BoneLength) - (x1c_p2p1Length * x1c_p2p1Length)) / + (twoMag * x20_p1BoneLength), + 1.f)); + float f30 = std::acos(zeus::clamp( + -1.f, + ((x1c_p2p1Length * (magSq - (x20_p1BoneLength * x20_p1BoneLength))) + x1c_p2p1Length) / (twoMag * x1c_p2p1Length), + 1.f)); zeus::CVector3f vecA = q2.transform(x10_p1BoneDir); zeus::CVector3f crossVecA = x4_p2p1Dir.cross(vecA); diff --git a/Runtime/Character/CInt32POINode.cpp b/Runtime/Character/CInt32POINode.cpp index 9c4870242..324ff54f4 100644 --- a/Runtime/Character/CInt32POINode.cpp +++ b/Runtime/Character/CInt32POINode.cpp @@ -6,8 +6,8 @@ namespace metaforce { CInt32POINode::CInt32POINode() : CInt32POINode(""sv, EPOIType::EmptyInt32, CCharAnimTime(), -1, false, 1.f, -1, 0, 0, "root"sv) {} -CInt32POINode::CInt32POINode(std::string_view name, EPOIType type, const CCharAnimTime& time, s32 index, bool unique, float weight, s32 charIndex, - s32 flags, s32 val, std::string_view locator) +CInt32POINode::CInt32POINode(std::string_view name, EPOIType type, const CCharAnimTime& time, s32 index, bool unique, + float weight, s32 charIndex, s32 flags, s32 val, std::string_view locator) : CPOINode(name, type, time, index, unique, weight, charIndex, flags), x38_val(val), x3c_locatorName(locator) {} CInt32POINode::CInt32POINode(CInputStream& in) diff --git a/Runtime/Character/CMakeLists.txt b/Runtime/Character/CMakeLists.txt index d984308c3..2b79fb83e 100644 --- a/Runtime/Character/CMakeLists.txt +++ b/Runtime/Character/CMakeLists.txt @@ -1,97 +1,97 @@ set(CHARACTER_SOURCES - CharacterCommon.hpp CharacterCommon.cpp - CAssetFactory.hpp CAssetFactory.cpp - CCharacterFactory.hpp CCharacterFactory.cpp - CModelData.hpp CModelData.cpp - CAnimData.hpp CAnimData.cpp - CCharAnimTime.hpp CCharAnimTime.cpp - IMetaAnim.hpp IMetaAnim.cpp - IMetaTrans.hpp - IVaryingAnimationTimeScale.hpp - CAnimationDatabase.hpp - CAnimationDatabaseGame.hpp CAnimationDatabaseGame.cpp - CTransitionDatabase.hpp - CTransitionDatabaseGame.hpp CTransitionDatabaseGame.cpp - CHierarchyPoseBuilder.hpp CHierarchyPoseBuilder.cpp - CPoseAsTransforms.hpp CPoseAsTransforms.cpp - CSkinBank.hpp CSkinBank.cpp - CCharLayoutInfo.hpp CCharLayoutInfo.cpp - CLayoutDescription.hpp - CSegIdList.hpp CSegIdList.cpp - CSegId.hpp - TSegIdMap.hpp - CIkChain.hpp CIkChain.cpp - CSkinRules.hpp CSkinRules.cpp - CAnimCharacterSet.hpp CAnimCharacterSet.cpp - CAnimationSet.hpp CAnimationSet.cpp - CCharacterSet.hpp CCharacterSet.cpp - CCharacterInfo.hpp CCharacterInfo.cpp - CPASDatabase.hpp CPASDatabase.cpp - CPASAnimState.hpp CPASAnimState.cpp - CPASParmInfo.hpp CPASParmInfo.cpp - CPASAnimInfo.hpp CPASAnimInfo.cpp - CPASAnimParm.hpp - CPASAnimParmData.hpp CPASAnimParmData.cpp - CEffectComponent.hpp CEffectComponent.cpp - CAnimation.hpp CAnimation.cpp - CAnimationManager.hpp CAnimationManager.cpp - CTransition.hpp CTransition.cpp - CTransitionManager.hpp CTransitionManager.cpp - CMetaAnimFactory.hpp CMetaAnimFactory.cpp - CMetaAnimPlay.hpp CMetaAnimPlay.cpp - CMetaAnimBlend.hpp CMetaAnimBlend.cpp - CMetaAnimPhaseBlend.hpp CMetaAnimPhaseBlend.cpp - CMetaAnimRandom.hpp CMetaAnimRandom.cpp - CMetaAnimSequence.hpp CMetaAnimSequence.cpp - CMetaTransFactory.hpp CMetaTransFactory.cpp - CMetaTransMetaAnim.hpp CMetaTransMetaAnim.cpp - CMetaTransTrans.hpp CMetaTransTrans.cpp - CMetaTransPhaseTrans.hpp CMetaTransPhaseTrans.cpp - CMetaTransSnap.hpp CMetaTransSnap.cpp - CAnimTreeLoopIn.hpp CAnimTreeLoopIn.cpp - CAnimTreeSequence.hpp CAnimTreeSequence.cpp - CSequenceHelper.hpp CSequenceHelper.cpp - CAnimTreeAnimReaderContainer.hpp CAnimTreeAnimReaderContainer.cpp - CTreeUtils.hpp CTreeUtils.cpp - CAnimTreeBlend.hpp CAnimTreeBlend.cpp - CAnimTreeNode.hpp CAnimTreeNode.cpp - CAnimTreeTimeScale.hpp CAnimTreeTimeScale.cpp - CAnimTreeTransition.hpp CAnimTreeTransition.cpp - CAnimTreeTweenBase.hpp CAnimTreeTweenBase.cpp - CAnimTreeSingleChild.hpp CAnimTreeSingleChild.cpp - CAnimTreeDoubleChild.hpp CAnimTreeDoubleChild.cpp - CAnimPlaybackParms.hpp - IAnimReader.hpp IAnimReader.cpp - CPrimitive.hpp CPrimitive.cpp - CHalfTransition.hpp CHalfTransition.cpp - CTimeScaleFunctions.hpp CTimeScaleFunctions.cpp - CParticleData.hpp CParticleData.cpp - CParticleDatabase.hpp CParticleDatabase.cpp - CParticleGenInfo.hpp CParticleGenInfo.cpp - CAnimPOIData.hpp CAnimPOIData.cpp - CPOINode.hpp CPOINode.cpp - CBoolPOINode.hpp CBoolPOINode.cpp - CInt32POINode.hpp CInt32POINode.cpp - CSoundPOINode.hpp CSoundPOINode.cpp - CParticlePOINode.hpp CParticlePOINode.cpp - CAnimSourceReader.hpp CAnimSourceReader.cpp - CAnimSource.hpp CAnimSource.cpp - CFBStreamedAnimReader.hpp CFBStreamedAnimReader.cpp - CFBStreamedCompression.hpp CFBStreamedCompression.cpp - CAllFormatsAnimSource.hpp CAllFormatsAnimSource.cpp - CSegStatementSet.hpp CSegStatementSet.cpp - CAnimPerSegmentData.hpp - CAdditiveAnimPlayback.hpp CAdditiveAnimPlayback.cpp - CActorLights.hpp CActorLights.cpp - CAnimSysContext.hpp - CBodyState.hpp CBodyState.cpp - CAdditiveBodyState.hpp CAdditiveBodyState.cpp - CBodyStateCmdMgr.hpp CBodyStateCmdMgr.cpp - CBodyController.hpp CBodyController.cpp - CGroundMovement.hpp CGroundMovement.cpp - CSteeringBehaviors.hpp CSteeringBehaviors.cpp - CBodyStateInfo.hpp CBodyStateInfo.cpp - CBoneTracking.hpp CBoneTracking.cpp - CRagDoll.hpp CRagDoll.cpp) + CharacterCommon.hpp CharacterCommon.cpp + CAssetFactory.hpp CAssetFactory.cpp + CCharacterFactory.hpp CCharacterFactory.cpp + CModelData.hpp CModelData.cpp + CAnimData.hpp CAnimData.cpp + CCharAnimTime.hpp CCharAnimTime.cpp + IMetaAnim.hpp IMetaAnim.cpp + IMetaTrans.hpp + IVaryingAnimationTimeScale.hpp + CAnimationDatabase.hpp + CAnimationDatabaseGame.hpp CAnimationDatabaseGame.cpp + CTransitionDatabase.hpp + CTransitionDatabaseGame.hpp CTransitionDatabaseGame.cpp + CHierarchyPoseBuilder.hpp CHierarchyPoseBuilder.cpp + CPoseAsTransforms.hpp CPoseAsTransforms.cpp + CSkinBank.hpp CSkinBank.cpp + CCharLayoutInfo.hpp CCharLayoutInfo.cpp + CLayoutDescription.hpp + CSegIdList.hpp CSegIdList.cpp + CSegId.hpp + TSegIdMap.hpp + CIkChain.hpp CIkChain.cpp + CSkinRules.hpp CSkinRules.cpp + CAnimCharacterSet.hpp CAnimCharacterSet.cpp + CAnimationSet.hpp CAnimationSet.cpp + CCharacterSet.hpp CCharacterSet.cpp + CCharacterInfo.hpp CCharacterInfo.cpp + CPASDatabase.hpp CPASDatabase.cpp + CPASAnimState.hpp CPASAnimState.cpp + CPASParmInfo.hpp CPASParmInfo.cpp + CPASAnimInfo.hpp CPASAnimInfo.cpp + CPASAnimParm.hpp + CPASAnimParmData.hpp CPASAnimParmData.cpp + CEffectComponent.hpp CEffectComponent.cpp + CAnimation.hpp CAnimation.cpp + CAnimationManager.hpp CAnimationManager.cpp + CTransition.hpp CTransition.cpp + CTransitionManager.hpp CTransitionManager.cpp + CMetaAnimFactory.hpp CMetaAnimFactory.cpp + CMetaAnimPlay.hpp CMetaAnimPlay.cpp + CMetaAnimBlend.hpp CMetaAnimBlend.cpp + CMetaAnimPhaseBlend.hpp CMetaAnimPhaseBlend.cpp + CMetaAnimRandom.hpp CMetaAnimRandom.cpp + CMetaAnimSequence.hpp CMetaAnimSequence.cpp + CMetaTransFactory.hpp CMetaTransFactory.cpp + CMetaTransMetaAnim.hpp CMetaTransMetaAnim.cpp + CMetaTransTrans.hpp CMetaTransTrans.cpp + CMetaTransPhaseTrans.hpp CMetaTransPhaseTrans.cpp + CMetaTransSnap.hpp CMetaTransSnap.cpp + CAnimTreeLoopIn.hpp CAnimTreeLoopIn.cpp + CAnimTreeSequence.hpp CAnimTreeSequence.cpp + CSequenceHelper.hpp CSequenceHelper.cpp + CAnimTreeAnimReaderContainer.hpp CAnimTreeAnimReaderContainer.cpp + CTreeUtils.hpp CTreeUtils.cpp + CAnimTreeBlend.hpp CAnimTreeBlend.cpp + CAnimTreeNode.hpp CAnimTreeNode.cpp + CAnimTreeTimeScale.hpp CAnimTreeTimeScale.cpp + CAnimTreeTransition.hpp CAnimTreeTransition.cpp + CAnimTreeTweenBase.hpp CAnimTreeTweenBase.cpp + CAnimTreeSingleChild.hpp CAnimTreeSingleChild.cpp + CAnimTreeDoubleChild.hpp CAnimTreeDoubleChild.cpp + CAnimPlaybackParms.hpp + IAnimReader.hpp IAnimReader.cpp + CPrimitive.hpp CPrimitive.cpp + CHalfTransition.hpp CHalfTransition.cpp + CTimeScaleFunctions.hpp CTimeScaleFunctions.cpp + CParticleData.hpp CParticleData.cpp + CParticleDatabase.hpp CParticleDatabase.cpp + CParticleGenInfo.hpp CParticleGenInfo.cpp + CAnimPOIData.hpp CAnimPOIData.cpp + CPOINode.hpp CPOINode.cpp + CBoolPOINode.hpp CBoolPOINode.cpp + CInt32POINode.hpp CInt32POINode.cpp + CSoundPOINode.hpp CSoundPOINode.cpp + CParticlePOINode.hpp CParticlePOINode.cpp + CAnimSourceReader.hpp CAnimSourceReader.cpp + CAnimSource.hpp CAnimSource.cpp + CFBStreamedAnimReader.hpp CFBStreamedAnimReader.cpp + CFBStreamedCompression.hpp CFBStreamedCompression.cpp + CAllFormatsAnimSource.hpp CAllFormatsAnimSource.cpp + CSegStatementSet.hpp CSegStatementSet.cpp + CAnimPerSegmentData.hpp + CAdditiveAnimPlayback.hpp CAdditiveAnimPlayback.cpp + CActorLights.hpp CActorLights.cpp + CAnimSysContext.hpp + CBodyState.hpp CBodyState.cpp + CAdditiveBodyState.hpp CAdditiveBodyState.cpp + CBodyStateCmdMgr.hpp CBodyStateCmdMgr.cpp + CBodyController.hpp CBodyController.cpp + CGroundMovement.hpp CGroundMovement.cpp + CSteeringBehaviors.hpp CSteeringBehaviors.cpp + CBodyStateInfo.hpp CBodyStateInfo.cpp + CBoneTracking.hpp CBoneTracking.cpp + CRagDoll.hpp CRagDoll.cpp) runtime_add_list(Character CHARACTER_SOURCES) diff --git a/Runtime/Character/CMetaAnimBlend.cpp b/Runtime/Character/CMetaAnimBlend.cpp index a6c68d5e8..67d81f3d2 100644 --- a/Runtime/Character/CMetaAnimBlend.cpp +++ b/Runtime/Character/CMetaAnimBlend.cpp @@ -20,13 +20,12 @@ void CMetaAnimBlend::GetUniquePrimitives(std::set& primsOut) const { std::shared_ptr CMetaAnimBlend::VGetAnimationTree(const CAnimSysContext& animSys, const CMetaAnimTreeBuildOrders& orders) const { CMetaAnimTreeBuildOrders oa = CMetaAnimTreeBuildOrders::NoSpecialOrders(); - CMetaAnimTreeBuildOrders ob = orders.x0_recursiveAdvance ? - CMetaAnimTreeBuildOrders::PreAdvanceForAll(*orders.x0_recursiveAdvance) : - CMetaAnimTreeBuildOrders::NoSpecialOrders(); + CMetaAnimTreeBuildOrders ob = orders.x0_recursiveAdvance + ? CMetaAnimTreeBuildOrders::PreAdvanceForAll(*orders.x0_recursiveAdvance) + : CMetaAnimTreeBuildOrders::NoSpecialOrders(); auto a = x4_animA->GetAnimationTree(animSys, oa); auto b = x8_animB->GetAnimationTree(animSys, ob); - return std::make_shared(x10_, a, b, xc_blend, - CAnimTreeBlend::CreatePrimitiveName(a, b, xc_blend)); + return std::make_shared(x10_, a, b, xc_blend, CAnimTreeBlend::CreatePrimitiveName(a, b, xc_blend)); } } // namespace metaforce diff --git a/Runtime/Character/CMetaAnimPhaseBlend.cpp b/Runtime/Character/CMetaAnimPhaseBlend.cpp index 68212cb2a..da9d00cde 100644 --- a/Runtime/Character/CMetaAnimPhaseBlend.cpp +++ b/Runtime/Character/CMetaAnimPhaseBlend.cpp @@ -31,10 +31,10 @@ std::shared_ptr CMetaAnimPhaseBlend::VGetAnimationTree(const CAni float fa = da / dblend; float fb = db / dblend; - auto tsa = std::make_shared(a, fa, - CAnimTreeTimeScale::CreatePrimitiveName(a, fa, CCharAnimTime::Infinity(), -1.f)); - auto tsb = std::make_shared(b, fb, - CAnimTreeTimeScale::CreatePrimitiveName(b, fb, CCharAnimTime::Infinity(), -1.f)); + auto tsa = std::make_shared( + a, fa, CAnimTreeTimeScale::CreatePrimitiveName(a, fa, CCharAnimTime::Infinity(), -1.f)); + auto tsb = std::make_shared( + b, fb, CAnimTreeTimeScale::CreatePrimitiveName(b, fb, CCharAnimTime::Infinity(), -1.f)); return std::make_shared(x10_, tsa, tsb, xc_blend, CAnimTreeBlend::CreatePrimitiveName(tsa, tsb, xc_blend)); diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index 33f71d906..19b6dadcf 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -118,8 +118,7 @@ public: void RenderParticles(const zeus::CFrustum& frustum) const; void Touch(EWhichModel, int shaderIdx) const; void Touch(const CStateManager& stateMgr, int shaderIdx) const; - void RenderThermal(const zeus::CColor& mulColor, const zeus::CColor& addColor, - const CModelFlags& flags) const; + void RenderThermal(const zeus::CColor& mulColor, const zeus::CColor& addColor, const CModelFlags& flags) const; void RenderThermal(const zeus::CTransform& xf, const zeus::CColor& mulColor, const zeus::CColor& addColor, const CModelFlags& flags) const; void RenderUnsortedParts(EWhichModel, const zeus::CTransform& xf, const CActorLights* lights, diff --git a/Runtime/Character/CParticleDatabase.cpp b/Runtime/Character/CParticleDatabase.cpp index dc6f65e91..8e3d02146 100644 --- a/Runtime/Character/CParticleDatabase.cpp +++ b/Runtime/Character/CParticleDatabase.cpp @@ -99,8 +99,7 @@ void CParticleDatabase::UpdateParticleGenDB(float dt, const CPoseAsTransforms& p switch (info.GetParentedMode()) { case CParticleData::EParentedMode::Initial: { if (info.GetIsGrabInitialData()) { - zeus::CTransform segXf((info.GetFlags() & 0x10) ? zeus::CMatrix3f() - : pose.GetTransformMinusOffset(segId), + zeus::CTransform segXf((info.GetFlags() & 0x10) ? zeus::CMatrix3f() : pose.GetTransformMinusOffset(segId), off * scale); zeus::CTransform compXf = xf * segXf; info.SetCurTransform(compXf.getRotation()); diff --git a/Runtime/Character/CPoseAsTransforms.hpp b/Runtime/Character/CPoseAsTransforms.hpp index 1c5cf5bb6..96ebd13d2 100644 --- a/Runtime/Character/CPoseAsTransforms.hpp +++ b/Runtime/Character/CPoseAsTransforms.hpp @@ -15,6 +15,7 @@ namespace metaforce { class CPoseAsTransforms { friend class CAnimData; + public: struct Transform { zeus::CTransform m_originToAccum; diff --git a/Runtime/Character/CSteeringBehaviors.cpp b/Runtime/Character/CSteeringBehaviors.cpp index 79c29fb8b..ddd1eb8ba 100644 --- a/Runtime/Character/CSteeringBehaviors.cpp +++ b/Runtime/Character/CSteeringBehaviors.cpp @@ -71,8 +71,8 @@ zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, Entity return align * (diff / M_PIF); } -zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, EntityList& list, - float dampingRadius, const CStateManager& mgr) const { +zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, EntityList& list, float dampingRadius, + const CStateManager& mgr) const { zeus::CVector3f dest; if (!list.empty()) { for (const TUniqueId& id : list) diff --git a/Runtime/Character/CSteeringBehaviors.hpp b/Runtime/Character/CSteeringBehaviors.hpp index 0c68c7c47..2c2ddb59e 100644 --- a/Runtime/Character/CSteeringBehaviors.hpp +++ b/Runtime/Character/CSteeringBehaviors.hpp @@ -19,10 +19,9 @@ public: zeus::CVector3f Arrival(const CPhysicsActor& actor, const zeus::CVector3f& dest, float dampingRadius) const; zeus::CVector3f Pursuit(const CPhysicsActor& actor, const zeus::CVector3f& v0, const zeus::CVector3f& v1) const; zeus::CVector3f Separation(const CPhysicsActor& actor, const zeus::CVector3f& pos, float separation) const; - zeus::CVector3f Alignment(const CPhysicsActor& actor, EntityList& list, - const CStateManager& mgr) const; - zeus::CVector3f Cohesion(const CPhysicsActor& actor, EntityList& list, - float dampingRadius, const CStateManager& mgr) const; + zeus::CVector3f Alignment(const CPhysicsActor& actor, EntityList& list, const CStateManager& mgr) const; + zeus::CVector3f Cohesion(const CPhysicsActor& actor, EntityList& list, float dampingRadius, + const CStateManager& mgr) const; zeus::CVector2f Flee2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const; zeus::CVector2f Arrival2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const; static bool SolveQuadratic(float, float, float, float&, float&); diff --git a/Runtime/Character/CTransitionDatabaseGame.cpp b/Runtime/Character/CTransitionDatabaseGame.cpp index fd3407587..7c7a07204 100644 --- a/Runtime/Character/CTransitionDatabaseGame.cpp +++ b/Runtime/Character/CTransitionDatabaseGame.cpp @@ -17,13 +17,13 @@ CTransitionDatabaseGame::CTransitionDatabaseGame(const std::vector& for (const CTransition& trans : transitions) x14_transitions.emplace_back(trans.GetAnimPair(), trans.GetMetaTrans()); std::sort(x14_transitions.begin(), x14_transitions.end(), - [](const auto& a, const auto& b) { return a.first < b.first; }); + [](const auto& a, const auto& b) { return a.first < b.first; }); x24_halfTransitions.reserve(halfTransitions.size()); for (const CHalfTransition& trans : halfTransitions) x24_halfTransitions.emplace_back(trans.GetId(), trans.GetMetaTrans()); std::sort(x24_halfTransitions.begin(), x24_halfTransitions.end(), - [](const auto& a, const auto& b) { return a.first < b.first; }); + [](const auto& a, const auto& b) { return a.first < b.first; }); } const std::shared_ptr& CTransitionDatabaseGame::GetMetaTrans(u32 a, u32 b) const { diff --git a/Runtime/Character/IAnimReader.hpp b/Runtime/Character/IAnimReader.hpp index 6988d90a0..b7961b937 100644 --- a/Runtime/Character/IAnimReader.hpp +++ b/Runtime/Character/IAnimReader.hpp @@ -82,9 +82,7 @@ public: return &source->GetAsCAnimSource(); } - const CAnimSource* GetObj() const override { - return const_cast*>(this)->GetObj(); - } + const CAnimSource* GetObj() const override { return const_cast*>(this)->GetObj(); } }; template <> @@ -118,8 +116,8 @@ public: u32) const = 0; virtual size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator, u32) const = 0; - virtual size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator, - u32) const = 0; + virtual size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, + size_t iterator, u32) const = 0; virtual size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator, u32) const = 0; virtual bool VGetBoolPOIState(std::string_view name) const = 0; diff --git a/Runtime/Collision/CCollidableOBBTree.cpp b/Runtime/Collision/CCollidableOBBTree.cpp index ff224bfe0..f8502f9f8 100644 --- a/Runtime/Collision/CCollidableOBBTree.cpp +++ b/Runtime/Collision/CCollidableOBBTree.cpp @@ -189,7 +189,8 @@ bool CCollidableOBBTree::SphereCollideWithLeafMoving(const COBBTree::CLeafData& zeus::CVector3f vtsRej = vertToSphere - vtsDotEdge * edgeVec; if (edgeRejMagSq > 0.f) { const float tmp = 2.f * vtsRej.dot(edgeRej); - const float tmp2 = 4.f * edgeRejMagSq * (vtsRej.magSquared() - sphere.radius * sphere.radius) - tmp * tmp; + const float tmp2 = + 4.f * edgeRejMagSq * (vtsRej.magSquared() - sphere.radius * sphere.radius) - tmp * tmp; if (tmp2 >= 0.f) { const float mag2 = 0.5f / edgeRejMagSq * (-tmp - std::sqrt(tmp2)); if (mag2 >= 0.f) { diff --git a/Runtime/Collision/CCollidableOBBTreeGroup.cpp b/Runtime/Collision/CCollidableOBBTreeGroup.cpp index 6e9a41804..30c56ef28 100644 --- a/Runtime/Collision/CCollidableOBBTreeGroup.cpp +++ b/Runtime/Collision/CCollidableOBBTreeGroup.cpp @@ -27,7 +27,8 @@ CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(CInputStream& } } -CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(const zeus::CVector3f& extent, const zeus::CVector3f& center) { +CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(const zeus::CVector3f& extent, + const zeus::CVector3f& center) { x0_trees.push_back(COBBTree::BuildOrientedBoundingBoxTree(extent, center)); for (const std::unique_ptr& tree : x0_trees) { @@ -40,7 +41,8 @@ CCollidableOBBTreeGroup::CCollidableOBBTreeGroup(const CCollidableOBBTreeGroupCo const CMaterialList& matList) : CCollisionPrimitive(matList), x10_container(container) {} -void CCollidableOBBTreeGroup::ResetTestStats() const { /* Remove me? */ } +void CCollidableOBBTreeGroup::ResetTestStats() const { /* Remove me? */ +} u32 CCollidableOBBTreeGroup::GetTableIndex() const { return sTableIndex; } @@ -63,8 +65,7 @@ CRayCastResult CCollidableOBBTreeGroup::CastRayInternal(const CInternalRayCastSt float tMin = 0.f; float tMax = 0.f; if (CollisionUtil::RayAABoxIntersection(xfRay, *aabbIt++, tMin, tMax)) { - CInternalRayCastStructure localCast(xfRay.start, xfRay.dir, mag, zeus::CTransform(), - rayCast.GetFilter()); + CInternalRayCastStructure localCast(xfRay.start, xfRay.dir, mag, zeus::CTransform(), rayCast.GetFilter()); CRayCastResult localResult = obbTree.CastRayInternal(localCast); if (localResult.IsValid()) { if (ret.IsInvalid() || localResult.GetT() < ret.GetT()) { diff --git a/Runtime/Collision/CCollidableSphere.cpp b/Runtime/Collision/CCollidableSphere.cpp index 559d866d9..0868acdf8 100644 --- a/Runtime/Collision/CCollidableSphere.cpp +++ b/Runtime/Collision/CCollidableSphere.cpp @@ -160,8 +160,7 @@ bool Sphere_Sphere(const CInternalCollisionStructure& collision, CCollisionInfoL zeus::CVector3f delta = s0.position - s1.position; float deltaMagSq = delta.magSquared(); if (deltaMagSq <= radiusSum * radiusSum) { - zeus::CVector3f deltaNorm = - delta.canBeNormalized() ? (1.f / std::sqrt(deltaMagSq)) * delta : zeus::skRight; + zeus::CVector3f deltaNorm = delta.canBeNormalized() ? (1.f / std::sqrt(deltaMagSq)) * delta : zeus::skRight; zeus::CVector3f collisionPoint = deltaNorm * s1.radius + s1.position; CCollisionInfo info(collisionPoint, p0.GetMaterial(), p1.GetMaterial(), deltaNorm); list.Add(info, false); diff --git a/Runtime/Collision/CCollisionActor.hpp b/Runtime/Collision/CCollisionActor.hpp index 3647b7f78..3c4f2d28f 100644 --- a/Runtime/Collision/CCollisionActor.hpp +++ b/Runtime/Collision/CCollisionActor.hpp @@ -34,6 +34,7 @@ class CCollisionActor : public CPhysicsActor { zeus::CVector3f x304_extendedTouchBounds = zeus::skZero3f; CAABoxShader m_aabox; + public: DEFINE_ENTITY CCollisionActor(TUniqueId uid, TAreaId areaId, TUniqueId owner, const zeus::CVector3f& extent, diff --git a/Runtime/Collision/CCollisionActorManager.hpp b/Runtime/Collision/CCollisionActorManager.hpp index e9e869de3..0b248adf3 100644 --- a/Runtime/Collision/CCollisionActorManager.hpp +++ b/Runtime/Collision/CCollisionActorManager.hpp @@ -39,7 +39,9 @@ public: [[nodiscard]] u32 GetNumCollisionActors() const { return x0_jointDescriptions.size(); } std::optional GetDeviation(const CStateManager&, CSegId); - [[nodiscard]] const CJointCollisionDescription& GetCollisionDescFromIndex(u32 i) const { return x0_jointDescriptions[i]; } + [[nodiscard]] const CJointCollisionDescription& GetCollisionDescFromIndex(u32 i) const { + return x0_jointDescriptions[i]; + } static zeus::CTransform GetWRLocatorTransform(const CAnimData& animData, CSegId id, const zeus::CTransform& worldXf, const zeus::CTransform& localXf); }; diff --git a/Runtime/Collision/CCollisionInfoList.hpp b/Runtime/Collision/CCollisionInfoList.hpp index 75c3f0a48..e0dc4c609 100644 --- a/Runtime/Collision/CCollisionInfoList.hpp +++ b/Runtime/Collision/CCollisionInfoList.hpp @@ -59,9 +59,6 @@ public: auto begin() noexcept { return x0_list.begin(); } auto begin() const noexcept { return x0_list.begin(); } - - - void AccumulateNewContactsInto(CCollisionInfoList& other_list) { for (CCollisionInfo const& cur_info : x0_list) { bool dont_add_new_info = false; diff --git a/Runtime/Collision/CGameCollision.cpp b/Runtime/Collision/CGameCollision.cpp index e3a6f2910..a8754e4e7 100644 --- a/Runtime/Collision/CGameCollision.cpp +++ b/Runtime/Collision/CGameCollision.cpp @@ -58,8 +58,7 @@ void CGameCollision::InitCollision() { CCollisionPrimitive::InitEndColliders(); } -void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt, - const EntityList* colliderList) { +void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt, const EntityList* colliderList) { actor.SetAngularEnabled(true); actor.AddMotionState(actor.PredictAngularMotion(dt)); if (!actor.IsUseStandardCollider()) { @@ -195,8 +194,7 @@ zeus::CVector3f CGameCollision::GetActorRelativeVelocities(const CPhysicsActor& return ret; } -void CGameCollision::Move(CStateManager& mgr, CPhysicsActor& actor, float dt, - const EntityList* colliderList) { +void CGameCollision::Move(CStateManager& mgr, CPhysicsActor& actor, float dt, const EntityList* colliderList) { if (!actor.IsMovable()) return; if (actor.GetMaterialList().HasMaterial(EMaterialTypes::GroundCollider) || actor.WillMove(mgr)) { @@ -323,8 +321,7 @@ CRayCastResult CGameCollision::RayDynamicIntersection(const CStateManager& mgr, bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos, const zeus::CVector3f& dir, const CMaterialFilter& filter, - const EntityList& nearList, - const CActor* damagee, float length) { + const EntityList& nearList, const CActor* damagee, float length) { if (length <= 0.f) { length = 100000.f; } @@ -349,8 +346,7 @@ bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const CRayCastResult CGameCollision::RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag, - const CMaterialFilter& filter, - const EntityList& nearList) { + const CMaterialFilter& filter, const EntityList& nearList) { CRayCastResult staticRes = RayStaticIntersection(mgr, pos, dir, mag, filter); CRayCastResult dynamicRes = RayDynamicIntersection(mgr, idOut, pos, dir, mag, filter, nearList); @@ -418,8 +414,7 @@ bool CGameCollision::DetectCollisionBoolean(const CStateManager& mgr, const CCol bool CGameCollision::DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, - const EntityList& nearList) { + const CMaterialFilter& filter, const EntityList& nearList) { if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) && DetectStaticCollisionBoolean_Cached(mgr, cache, prim, xf, filter)) { return true; @@ -501,8 +496,7 @@ bool CGameCollision::DetectStaticCollisionBoolean_Cached(const CStateManager& mg } bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const EntityList& nearList, - const CStateManager& mgr) { + const EntityList& nearList, const CStateManager& mgr) { for (const auto& id : nearList) { if (const TCastToConstPtr actor = mgr.GetObjectById(id)) { const CInternalCollisionStructure::CPrimDesc p0(prim, CMaterialFilter::skPassEverything, xf); @@ -519,8 +513,7 @@ bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& pr bool CGameCollision::DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, - const EntityList& nearList, TUniqueId& idOut, + const CMaterialFilter& filter, const EntityList& nearList, TUniqueId& idOut, CCollisionInfoList& infoList) { idOut = kInvalidUniqueId; bool ret = false; @@ -541,8 +534,7 @@ bool CGameCollision::DetectCollision_Cached(const CStateManager& mgr, CAreaColli bool CGameCollision::DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, - const EntityList& nearList, + const CMaterialFilter& filter, const EntityList& nearList, const zeus::CVector3f& dir, TUniqueId& idOut, CCollisionInfo& infoOut, double& d) { bool ret = false; @@ -686,8 +678,8 @@ bool CGameCollision::DetectStaticCollision_Cached_Moving(const CStateManager& mg } bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const EntityList& nearList, TUniqueId& idOut, - CCollisionInfoList& list, const CStateManager& mgr) { + const EntityList& nearList, TUniqueId& idOut, CCollisionInfoList& list, + const CStateManager& mgr) { for (const auto& id : nearList) { if (const TCastToConstPtr actor = mgr.GetObjectById(id)) { const CInternalCollisionStructure::CPrimDesc p0(prim, CMaterialFilter::skPassEverything, xf); @@ -704,9 +696,9 @@ bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, con } bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const EntityList& nearList, - const zeus::CVector3f& dir, TUniqueId& idOut, CCollisionInfo& infoOut, - double& dOut, const CStateManager& mgr) { + const EntityList& nearList, const zeus::CVector3f& dir, + TUniqueId& idOut, CCollisionInfo& infoOut, double& dOut, + const CStateManager& mgr) { bool ret = false; for (const auto& id : nearList) { double d = dOut; @@ -729,8 +721,7 @@ bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& pri bool CGameCollision::DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CMaterialFilter& filter, - const EntityList& nearList, TUniqueId& idOut, - CCollisionInfoList& infoOut) { + const EntityList& nearList, TUniqueId& idOut, CCollisionInfoList& infoOut) { bool ret = false; CMaterialList exclude = filter.ExcludeList(); if (!exclude.HasMaterial(EMaterialTypes::Occluder) && DetectStaticCollision(mgr, prim, xf, filter, infoOut)) { @@ -893,8 +884,7 @@ void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMateri } void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, - const CCollisionPrimitive& prim, - const EntityList& nearList, float f1, + const CCollisionPrimitive& prim, const EntityList& nearList, float f1, u32 failsafeTicks) { actor.MoveCollisionPrimitive(zeus::skZero3f); if (f1 > 0.5f) { @@ -942,8 +932,7 @@ void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionC std::optional CGameCollision::FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, - const CCollisionPrimitive& prim, - const EntityList& nearList) { + const CCollisionPrimitive& prim, const EntityList& nearList) { zeus::CTransform xf = actor.GetPrimitiveTransform(); zeus::CVector3f origOrigin = xf.origin; zeus::CVector3f center = prim.CalculateAABox(xf).center(); diff --git a/Runtime/Collision/CGameCollision.hpp b/Runtime/Collision/CGameCollision.hpp index 8e07cb073..e71c44eaa 100644 --- a/Runtime/Collision/CGameCollision.hpp +++ b/Runtime/Collision/CGameCollision.hpp @@ -24,8 +24,7 @@ class CStateManager; class ICollisionFilter; class CGameCollision { - static void MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt, - const EntityList* colliderList); + static void MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt, const EntityList* colliderList); static void MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter, const EntityList* colliderList); static zeus::CVector3f GetActorRelativeVelocities(const CPhysicsActor& act0, const CPhysicsActor* act1); @@ -38,8 +37,7 @@ public: static bool NullBooleanCollider(const CInternalCollisionStructure&) { return false; } static bool NullCollisionCollider(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; } static void InitCollision(); - static void Move(CStateManager& mgr, CPhysicsActor& actor, float dt, - const EntityList* colliderList); + static void Move(CStateManager& mgr, CPhysicsActor& actor, float dt, const EntityList* colliderList); static bool CanBlock(const CMaterialList&, const zeus::CUnitVector3f&); static bool IsFloor(const CMaterialList&, const zeus::CUnitVector3f&); @@ -53,8 +51,7 @@ public: const EntityList& nearList); static bool RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos, const zeus::CVector3f& dir, const CMaterialFilter& filter, - const EntityList& nearList, const CActor* damagee, - float length); + const EntityList& nearList, const CActor* damagee, float length); static CRayCastResult RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const EntityList& nearList); @@ -67,25 +64,21 @@ public: const EntityList& nearList); static bool DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, - const EntityList& nearList); + const CMaterialFilter& filter, const EntityList& nearList); static bool DetectStaticCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CMaterialFilter& filter); static bool DetectStaticCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CMaterialFilter& filter); static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const EntityList& nearList, - const CStateManager& mgr); + const EntityList& nearList, const CStateManager& mgr); static bool DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, - const EntityList& nearList, TUniqueId& idOut, + const CMaterialFilter& filter, const EntityList& nearList, TUniqueId& idOut, CCollisionInfoList& infoList); static bool DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, - const EntityList& nearList, + const CMaterialFilter& filter, const EntityList& nearList, const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut, double&); static bool DetectStaticCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, @@ -99,15 +92,14 @@ public: const CMaterialFilter& filter, const zeus::CVector3f& vec, CCollisionInfo& infoOut, double& d); static bool DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const EntityList& nearList, TUniqueId& idOut, - CCollisionInfoList& list, const CStateManager& mgr); + const EntityList& nearList, TUniqueId& idOut, CCollisionInfoList& list, + const CStateManager& mgr); static bool DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const EntityList& nearList, - const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut, - double& d, const CStateManager& mgr); + const EntityList& nearList, const zeus::CVector3f& vec, TUniqueId& idOut, + CCollisionInfo& infoOut, double& d, const CStateManager& mgr); static bool DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf, - const CMaterialFilter& filter, const EntityList& nearList, - TUniqueId& idOut, CCollisionInfoList& infoOut); + const CMaterialFilter& filter, const EntityList& nearList, TUniqueId& idOut, + CCollisionInfoList& infoOut); static void MakeCollisionCallbacks(CStateManager& mgr, CPhysicsActor& actor, TUniqueId id, const CCollisionInfoList& list); static void SendScriptMessages(CStateManager& mgr, CActor& a0, CActor* a1, const CCollisionInfoList& list); @@ -117,11 +109,10 @@ public: static void CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1, const zeus::CUnitVector3f& normal, float restitution, bool); static void CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, - const CCollisionPrimitive& prim, const EntityList& nearList, - float, u32 failsafeTicks); - static std::optional - FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, - const CCollisionPrimitive& prim, const EntityList& nearList); + const CCollisionPrimitive& prim, const EntityList& nearList, float, u32 failsafeTicks); + static std::optional FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, + CPhysicsActor& actor, const CCollisionPrimitive& prim, + const EntityList& nearList); static void AvoidStaticCollisionWithinRadius(const CStateManager& mgr, CPhysicsActor& actor, u32 iterations, float dt, float height, float size, float mass, float radius); }; diff --git a/Runtime/Collision/CJointCollisionDescription.cpp b/Runtime/Collision/CJointCollisionDescription.cpp index a04da6da4..32cd25466 100644 --- a/Runtime/Collision/CJointCollisionDescription.cpp +++ b/Runtime/Collision/CJointCollisionDescription.cpp @@ -21,14 +21,14 @@ CJointCollisionDescription CJointCollisionDescription::SphereSubdivideCollision( float radius, float maxSeparation, EOrientationType orientType, std::string_view name, float mass) { - return CJointCollisionDescription(ECollisionType::SphereSubdivide, pivotId, nextId, zeus::skZero3f, - zeus::skZero3f, radius, maxSeparation, orientType, name, mass); + return CJointCollisionDescription(ECollisionType::SphereSubdivide, pivotId, nextId, zeus::skZero3f, zeus::skZero3f, + radius, maxSeparation, orientType, name, mass); } CJointCollisionDescription CJointCollisionDescription::SphereCollision(CSegId pivotId, float radius, std::string_view name, float mass) { - return CJointCollisionDescription(ECollisionType::Sphere, pivotId, {}, zeus::skZero3f, - zeus::skZero3f, radius, 0.f, EOrientationType::Zero, name, mass); + return CJointCollisionDescription(ECollisionType::Sphere, pivotId, {}, zeus::skZero3f, zeus::skZero3f, radius, 0.f, + EOrientationType::Zero, name, mass); } CJointCollisionDescription CJointCollisionDescription::AABoxCollision(CSegId pivotId, const zeus::CVector3f& bounds, @@ -41,8 +41,8 @@ CJointCollisionDescription CJointCollisionDescription::OBBAutoSizeCollision(CSeg const zeus::CVector3f& bounds, EOrientationType orientType, std::string_view name, float mass) { - return CJointCollisionDescription(ECollisionType::OBBAutoSize, pivotId, nextId, bounds, zeus::skZero3f, 0.f, - 0.f, orientType, name, mass); + return CJointCollisionDescription(ECollisionType::OBBAutoSize, pivotId, nextId, bounds, zeus::skZero3f, 0.f, 0.f, + orientType, name, mass); } CJointCollisionDescription CJointCollisionDescription::OBBCollision(CSegId pivotId, const zeus::CVector3f& bounds, diff --git a/Runtime/Collision/CMakeLists.txt b/Runtime/Collision/CMakeLists.txt index 01f705a04..ddfe13e7e 100644 --- a/Runtime/Collision/CMakeLists.txt +++ b/Runtime/Collision/CMakeLists.txt @@ -1,30 +1,30 @@ set(COLLISION_SOURCES - CAreaOctTree.hpp CAreaOctTree.cpp - CollisionUtil.hpp CollisionUtil.cpp - CGameCollision.hpp CGameCollision.cpp - CCollisionResponseData.hpp CCollisionResponseData.cpp - CCollisionInfo.hpp CCollisionInfo.cpp - CCollisionInfoList.hpp - CCollisionEdge.hpp CCollisionEdge.cpp - CCollisionSurface.hpp CCollisionSurface.cpp - InternalColliders.hpp InternalColliders.cpp - CMetroidAreaCollider.hpp CMetroidAreaCollider.cpp - COBBTree.hpp COBBTree.cpp - CCollidableAABox.hpp CCollidableAABox.cpp - CCollidableCollisionSurface.hpp CCollidableCollisionSurface.cpp - CCollidableSphere.hpp CCollidableSphere.cpp - CCollidableOBBTree.hpp CCollidableOBBTree.cpp - CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp - CCollisionPrimitive.hpp CCollisionPrimitive.cpp - CMaterialList.hpp - CMaterialFilter.hpp CMaterialFilter.cpp - CInternalRayCastStructure.hpp - CRayCastResult.hpp CRayCastResult.cpp - CCollisionActor.hpp CCollisionActor.cpp - CCollisionActorManager.hpp CCollisionActorManager.cpp - CJointCollisionDescription.hpp CJointCollisionDescription.cpp - CAABoxFilter.hpp CAABoxFilter.cpp - CBallFilter.hpp CBallFilter.cpp - ICollisionFilter.hpp) + CAreaOctTree.hpp CAreaOctTree.cpp + CollisionUtil.hpp CollisionUtil.cpp + CGameCollision.hpp CGameCollision.cpp + CCollisionResponseData.hpp CCollisionResponseData.cpp + CCollisionInfo.hpp CCollisionInfo.cpp + CCollisionInfoList.hpp + CCollisionEdge.hpp CCollisionEdge.cpp + CCollisionSurface.hpp CCollisionSurface.cpp + InternalColliders.hpp InternalColliders.cpp + CMetroidAreaCollider.hpp CMetroidAreaCollider.cpp + COBBTree.hpp COBBTree.cpp + CCollidableAABox.hpp CCollidableAABox.cpp + CCollidableCollisionSurface.hpp CCollidableCollisionSurface.cpp + CCollidableSphere.hpp CCollidableSphere.cpp + CCollidableOBBTree.hpp CCollidableOBBTree.cpp + CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp + CCollisionPrimitive.hpp CCollisionPrimitive.cpp + CMaterialList.hpp + CMaterialFilter.hpp CMaterialFilter.cpp + CInternalRayCastStructure.hpp + CRayCastResult.hpp CRayCastResult.cpp + CCollisionActor.hpp CCollisionActor.cpp + CCollisionActorManager.hpp CCollisionActorManager.cpp + CJointCollisionDescription.hpp CJointCollisionDescription.cpp + CAABoxFilter.hpp CAABoxFilter.cpp + CBallFilter.hpp CBallFilter.cpp + ICollisionFilter.hpp) runtime_add_list(Collision COLLISION_SOURCES) diff --git a/Runtime/Collision/CMaterialFilter.hpp b/Runtime/Collision/CMaterialFilter.hpp index 13fa2d52a..b19ec696b 100644 --- a/Runtime/Collision/CMaterialFilter.hpp +++ b/Runtime/Collision/CMaterialFilter.hpp @@ -38,7 +38,6 @@ public: const CMaterialList& IncludeList() const noexcept { return x0_include; } const CMaterialList& ExcludeList() const noexcept { return x8_exclude; } - constexpr bool Passes(const CMaterialList& list) const noexcept { switch (x10_type) { case EFilterType::Always: diff --git a/Runtime/Collision/CMetroidAreaCollider.hpp b/Runtime/Collision/CMetroidAreaCollider.hpp index 57803fcaf..c72459529 100644 --- a/Runtime/Collision/CMetroidAreaCollider.hpp +++ b/Runtime/Collision/CMetroidAreaCollider.hpp @@ -185,10 +185,12 @@ public: u32 GetNumCaches() const { return x18_leafCaches.size(); } const CMetroidAreaCollider::COctreeLeafCache& GetOctreeLeafCache(int idx) { return x18_leafCaches[idx]; } bool HasCacheOverflowed() const { return x1b40_24_leafOverflow; } - rstl::reserved_vector::const_iterator begin() const - { return x18_leafCaches.begin(); } - rstl::reserved_vector::const_iterator end() const - { return x18_leafCaches.end(); } + rstl::reserved_vector::const_iterator begin() const { + return x18_leafCaches.begin(); + } + rstl::reserved_vector::const_iterator end() const { + return x18_leafCaches.end(); + } }; } // namespace metaforce diff --git a/Runtime/Collision/COBBTree.cpp b/Runtime/Collision/COBBTree.cpp index 7eee3d37b..fec3facd0 100644 --- a/Runtime/Collision/COBBTree.cpp +++ b/Runtime/Collision/COBBTree.cpp @@ -40,7 +40,6 @@ constexpr std::array DefaultSurfaceIndices{ 13, 8, 14, 13, 1, 15, 16, 14, 7, 16, 11, 2, 17, 15, 4, 17, 12, 9, }; - /* This is exactly what retro did >.< */ u32 verify_deaf_babe(CInputStream& in) { return in.readUint32Big(); } @@ -194,9 +193,8 @@ COBBTree::SIndexData::SIndexData(CInputStream& in) { } } -COBBTree::CNode::CNode(const zeus::CTransform& xf, const zeus::CVector3f& point, - std::unique_ptr&& left, std::unique_ptr&& right, - std::unique_ptr&& leaf) +COBBTree::CNode::CNode(const zeus::CTransform& xf, const zeus::CVector3f& point, std::unique_ptr&& left, + std::unique_ptr&& right, std::unique_ptr&& leaf) : x0_obb(xf, point) , x3c_isLeaf(leaf != nullptr) , x40_left(std::move(left)) diff --git a/Runtime/Collision/COBBTree.hpp b/Runtime/Collision/COBBTree.hpp index 2d14c5883..205f6a929 100644 --- a/Runtime/Collision/COBBTree.hpp +++ b/Runtime/Collision/COBBTree.hpp @@ -76,8 +76,7 @@ public: COBBTree() = default; explicit COBBTree(CInputStream&); - static std::unique_ptr BuildOrientedBoundingBoxTree(const zeus::CVector3f&, - const zeus::CVector3f&); + static std::unique_ptr BuildOrientedBoundingBoxTree(const zeus::CVector3f&, const zeus::CVector3f&); CCollisionSurface GetSurface(u16 idx) const; const u16* GetTriangleEdgeIndices(u16 idx) const { return &x18_indexData.x50_surfaceIndices[idx * 3]; } diff --git a/Runtime/Collision/CollisionUtil.cpp b/Runtime/Collision/CollisionUtil.cpp index 89736c31e..5173b28e4 100644 --- a/Runtime/Collision/CollisionUtil.cpp +++ b/Runtime/Collision/CollisionUtil.cpp @@ -583,9 +583,9 @@ bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxh const zeus::CVector3f v2 = trivert2 - boxcenter; /* compute triangle edges */ - const zeus::CVector3f e0 = v1 - v0; // Tri edge 0 - const zeus::CVector3f e1 = v2 - v1; // Tri edge 1 - const zeus::CVector3f e2 = v0 - v2; // Tri edge 2 + const zeus::CVector3f e0 = v1 - v0; // Tri edge 0 + const zeus::CVector3f e1 = v2 - v1; // Tri edge 1 + const zeus::CVector3f e2 = v0 - v2; // Tri edge 2 /* Bullet 3: */ /* test the 9 tests first (this was faster) */ diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index e5d769243..a45ce32fe 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -990,9 +990,7 @@ void CBooRenderer::PostRenderFogs() { x2ac_fogVolumes.clear(); } -void CBooRenderer::SetModelMatrix(const zeus::CTransform& xf) { - CGraphics::SetModelMatrix(xf); -} +void CBooRenderer::SetModelMatrix(const zeus::CTransform& xf) { CGraphics::SetModelMatrix(xf); } void CBooRenderer::AddParticleGen(CParticleGen& gen) { if (auto bounds = gen.GetBounds()) { zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.normal()); @@ -1250,7 +1248,7 @@ void CBooRenderer::PrepareDynamicLights(const std::vector& lights) { void CBooRenderer::SetGXRegister1Color(const zeus::CColor& color) { CGraphics::g_ColorRegs[1] = color; } void CBooRenderer::SetWorldLightFadeLevel(float level) { x2fc_tevReg1Color = zeus::CColor(level, level, level, 1.f); } -void CBooRenderer::SetWorldLightMultiplyColor(const zeus::CColor& color) { CGraphics::g_ColorRegs[2] = color;} +void CBooRenderer::SetWorldLightMultiplyColor(const zeus::CColor& color) { CGraphics::g_ColorRegs[2] = color; } void CBooRenderer::ReallyDrawPhazonSuitIndirectEffect(const zeus::CColor& vertColor, /*const CTexture& maskTex,*/ const CTexture& indTex, const zeus::CColor& modColor, float scale, diff --git a/Runtime/Graphics/CBooRenderer.hpp b/Runtime/Graphics/CBooRenderer.hpp index 97d2ab1fe..1f8bab6ee 100644 --- a/Runtime/Graphics/CBooRenderer.hpp +++ b/Runtime/Graphics/CBooRenderer.hpp @@ -40,13 +40,7 @@ class IObjectStore; class Buckets; -enum class EWorldShadowMode { - None, - WorldOnActorShadow, - BallOnWorldShadow, - BallOnWorldIds, - MAX -}; +enum class EWorldShadowMode { None, WorldOnActorShadow, BallOnWorldShadow, BallOnWorldIds, MAX }; class CBooRenderer final : public IRenderer { friend class CBooModel; @@ -197,8 +191,8 @@ public: int areaIdx, const SShader* shaderSet) override; void EnablePVS(const CPVSVisSet& set, u32 areaIdx) override; void DisablePVS() override; - void UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode = EWorldShadowMode::None, - bool activateLights = true, int cubeFace = -1, const CModelFlags* ballShadowFlags = nullptr); + void UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode = EWorldShadowMode::None, bool activateLights = true, + int cubeFace = -1, const CModelFlags* ballShadowFlags = nullptr); void RemoveStaticGeometry(const std::vector*) override; void DrawAreaGeometry(int areaIdx, int mask, int targetMask) override; void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender = false) override; diff --git a/Runtime/Graphics/CGraphics.cpp b/Runtime/Graphics/CGraphics.cpp index f89161d2a..36ed24dfa 100644 --- a/Runtime/Graphics/CGraphics.cpp +++ b/Runtime/Graphics/CGraphics.cpp @@ -450,15 +450,15 @@ void CGraphics::TickRenderTimings() { g_DefaultSeconds = g_RenderTimings / 60.f; } -static constexpr u64 FPS_REFRESH_RATE = 1000; +static constexpr u64 FPS_REFRESH_RATE = 1000; void CGraphics::UpdateFPSCounter() { ++g_FramesPast; std::chrono::duration timeElapsed = frame_clock::now() - g_FrameStartTime; if (timeElapsed.count() > FPS_REFRESH_RATE) { - g_Framerate = g_FramesPast; - g_FrameStartTime = frame_clock::now(); - g_FramesPast = 0; + g_Framerate = g_FramesPast; + g_FrameStartTime = frame_clock::now(); + g_FramesPast = 0; } } @@ -468,48 +468,58 @@ boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr; boo::ObjToken CGraphics::g_SpareTexture; const boo::SystemChar* CGraphics::g_BooPlatformName = nullptr; -const CTevCombiners::CTevPass CGraphics::sTevPass805a564c( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a564c({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, + GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, + GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5698( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_C0, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_A0, GX::TevAlphaArg::CA_ZERO}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5698({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, + GX::TevColorArg::CC_C0, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, + GX::TevAlphaArg::CA_A0, GX::TevAlphaArg::CA_ZERO}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5e70( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_C0}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_A0}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5e70({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, + GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_C0}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, + GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_A0}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5ebc( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_ZERO}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5ebc({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, + GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, + GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_ZERO}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5f08( - {GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_TEXA, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5f08({GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, + GX::TevColorArg::CC_TEXA, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, + GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5f54( - {GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ONE, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5f54({GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ONE, + GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, + GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5fa0( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5fa0({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, + GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, + GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA}); -const CTevCombiners::CTevPass CGraphics::sTevPass804bfcc0( - {GX::TevColorArg::CC_C0, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA}); +const CTevCombiners::CTevPass CGraphics::sTevPass804bfcc0({GX::TevColorArg::CC_C0, GX::TevColorArg::CC_TEXC, + GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, + GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a5fec( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a5fec({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, + GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, + GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a6038( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_KONST, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a6038({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC, + GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_KONST, + GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO}); -const CTevCombiners::CTevPass CGraphics::sTevPass805a6084( - {GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO}, - {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV}); +const CTevCombiners::CTevPass CGraphics::sTevPass805a6084({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, + GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO}, + {GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, + GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV}); } // namespace metaforce - diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 2b804748e..6f018da9d 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -221,14 +221,15 @@ class CTevPass { CTevOp x38_alphaOp; public: - CTevPass(const ColorPass& colPass, const AlphaPass& alphaPass, const CTevOp& colorOp = CTevOp(), const CTevOp alphaOp = CTevOp()) - : x0_id(++sNextUniquePass) - , x4_colorPass(colPass) - , x14_alphaPass(alphaPass) - , x24_colorOp(colorOp) - , x38_alphaOp(alphaOp) {} -}; + CTevPass(const ColorPass& colPass, const AlphaPass& alphaPass, const CTevOp& colorOp = CTevOp(), + const CTevOp alphaOp = CTevOp()) + : x0_id(++sNextUniquePass) + , x4_colorPass(colPass) + , x14_alphaPass(alphaPass) + , x24_colorOp(colorOp) + , x38_alphaOp(alphaOp) {} }; +}; // namespace CTevCombiners class CGraphics { public: @@ -364,7 +365,7 @@ public: g_BooMainCommandQueue->drawInstances(start, count, instCount, startInst); } static void DrawArray(size_t start, size_t count) { g_BooMainCommandQueue->draw(start, count); } - static void DrawArrayIndexed(size_t start, size_t count) { g_BooMainCommandQueue->drawIndexed(start, count); }\ + static void DrawArrayIndexed(size_t start, size_t count) { g_BooMainCommandQueue->drawIndexed(start, count); } static const CTevCombiners::CTevPass sTevPass805a564c; static const CTevCombiners::CTevPass sTevPass805a5698; @@ -428,14 +429,13 @@ class GraphicsDebugGroup { void operator delete(void*); void* operator new[](size_t); void operator delete[](void*); + public: explicit GraphicsDebugGroup(const char* name, const zeus::CColor& color = zeus::skWhite) { zeus::simd_floats f(color.mSimd); CGraphics::g_BooMainCommandQueue->pushDebugGroup(name, f.array()); } - ~GraphicsDebugGroup() { - CGraphics::g_BooMainCommandQueue->popDebugGroup(); - } + ~GraphicsDebugGroup() { CGraphics::g_BooMainCommandQueue->popDebugGroup(); } }; #define SCOPED_GRAPHICS_DEBUG_GROUP(...) GraphicsDebugGroup _GfxDbg_(__VA_ARGS__); #else diff --git a/Runtime/Graphics/CMakeLists.txt b/Runtime/Graphics/CMakeLists.txt index c19f80790..7938a5f3e 100644 --- a/Runtime/Graphics/CMakeLists.txt +++ b/Runtime/Graphics/CMakeLists.txt @@ -1,49 +1,49 @@ set(GRAPHICS_SOURCES - IRenderer.hpp - IWeaponRenderer.hpp IWeaponRenderer.cpp - CBooRenderer.hpp CBooRenderer.cpp - CDrawable.hpp - CDrawablePlaneObject.hpp - CLineRenderer.hpp CLineRenderer.cpp - CMetroidModelInstance.hpp - CLight.hpp CLight.cpp - CTexture.hpp CTextureBoo.cpp - CModel.hpp CModelBoo.cpp - CSkinnedModel.hpp CSkinnedModel.cpp - CVertexMorphEffect.hpp CVertexMorphEffect.cpp - CMoviePlayer.hpp CMoviePlayer.cpp - CGraphicsPalette.hpp - CPVSVisSet.hpp CPVSVisSet.cpp - CPVSVisOctree.hpp CPVSVisOctree.cpp - CPVSAreaSet.hpp CPVSAreaSet.cpp - CGraphics.hpp CGraphics.cpp - CSimpleShadow.hpp CSimpleShadow.cpp - CRainSplashGenerator.hpp CRainSplashGenerator.cpp - Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp - Shaders/CTexturedQuadFilter.hpp Shaders/CTexturedQuadFilter.cpp - Shaders/CColoredQuadFilter.hpp Shaders/CColoredQuadFilter.cpp - Shaders/CColoredStripShader.hpp Shaders/CColoredStripShader.cpp - Shaders/CModelShaders.hpp Shaders/CModelShaders.cpp - Shaders/CThermalColdFilter.hpp Shaders/CThermalColdFilter.cpp - Shaders/CThermalHotFilter.hpp Shaders/CThermalHotFilter.cpp - Shaders/CSpaceWarpFilter.hpp Shaders/CSpaceWarpFilter.cpp - Shaders/CCameraBlurFilter.hpp Shaders/CCameraBlurFilter.cpp - Shaders/CXRayBlurFilter.hpp Shaders/CXRayBlurFilter.cpp - Shaders/CTextSupportShader.hpp Shaders/CTextSupportShader.cpp - Shaders/CFogVolumePlaneShader.hpp Shaders/CFogVolumePlaneShader.cpp - Shaders/CFogVolumeFilter.hpp Shaders/CFogVolumeFilter.cpp - Shaders/CEnergyBarShader.hpp Shaders/CEnergyBarShader.cpp - Shaders/CRadarPaintShader.hpp Shaders/CRadarPaintShader.cpp - Shaders/CMapSurfaceShader.hpp Shaders/CMapSurfaceShader.cpp - Shaders/CPhazonSuitFilter.hpp Shaders/CPhazonSuitFilter.cpp - Shaders/CScanLinesFilter.hpp Shaders/CScanLinesFilter.cpp - Shaders/CRandomStaticFilter.hpp Shaders/CRandomStaticFilter.cpp - Shaders/CElementGenShaders.hpp Shaders/CElementGenShaders.cpp - Shaders/CDecalShaders.hpp Shaders/CDecalShaders.cpp - Shaders/CParticleSwooshShaders.hpp Shaders/CParticleSwooshShaders.cpp - Shaders/CFluidPlaneShader.hpp Shaders/CFluidPlaneShader.cpp - Shaders/CAABoxShader.hpp Shaders/CAABoxShader.cpp - Shaders/CWorldShadowShader.hpp Shaders/CWorldShadowShader.cpp - Shaders/CEnvFxShaders.hpp Shaders/CEnvFxShaders.cpp) + IRenderer.hpp + IWeaponRenderer.hpp IWeaponRenderer.cpp + CBooRenderer.hpp CBooRenderer.cpp + CDrawable.hpp + CDrawablePlaneObject.hpp + CLineRenderer.hpp CLineRenderer.cpp + CMetroidModelInstance.hpp + CLight.hpp CLight.cpp + CTexture.hpp CTextureBoo.cpp + CModel.hpp CModelBoo.cpp + CSkinnedModel.hpp CSkinnedModel.cpp + CVertexMorphEffect.hpp CVertexMorphEffect.cpp + CMoviePlayer.hpp CMoviePlayer.cpp + CGraphicsPalette.hpp + CPVSVisSet.hpp CPVSVisSet.cpp + CPVSVisOctree.hpp CPVSVisOctree.cpp + CPVSAreaSet.hpp CPVSAreaSet.cpp + CGraphics.hpp CGraphics.cpp + CSimpleShadow.hpp CSimpleShadow.cpp + CRainSplashGenerator.hpp CRainSplashGenerator.cpp + Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp + Shaders/CTexturedQuadFilter.hpp Shaders/CTexturedQuadFilter.cpp + Shaders/CColoredQuadFilter.hpp Shaders/CColoredQuadFilter.cpp + Shaders/CColoredStripShader.hpp Shaders/CColoredStripShader.cpp + Shaders/CModelShaders.hpp Shaders/CModelShaders.cpp + Shaders/CThermalColdFilter.hpp Shaders/CThermalColdFilter.cpp + Shaders/CThermalHotFilter.hpp Shaders/CThermalHotFilter.cpp + Shaders/CSpaceWarpFilter.hpp Shaders/CSpaceWarpFilter.cpp + Shaders/CCameraBlurFilter.hpp Shaders/CCameraBlurFilter.cpp + Shaders/CXRayBlurFilter.hpp Shaders/CXRayBlurFilter.cpp + Shaders/CTextSupportShader.hpp Shaders/CTextSupportShader.cpp + Shaders/CFogVolumePlaneShader.hpp Shaders/CFogVolumePlaneShader.cpp + Shaders/CFogVolumeFilter.hpp Shaders/CFogVolumeFilter.cpp + Shaders/CEnergyBarShader.hpp Shaders/CEnergyBarShader.cpp + Shaders/CRadarPaintShader.hpp Shaders/CRadarPaintShader.cpp + Shaders/CMapSurfaceShader.hpp Shaders/CMapSurfaceShader.cpp + Shaders/CPhazonSuitFilter.hpp Shaders/CPhazonSuitFilter.cpp + Shaders/CScanLinesFilter.hpp Shaders/CScanLinesFilter.cpp + Shaders/CRandomStaticFilter.hpp Shaders/CRandomStaticFilter.cpp + Shaders/CElementGenShaders.hpp Shaders/CElementGenShaders.cpp + Shaders/CDecalShaders.hpp Shaders/CDecalShaders.cpp + Shaders/CParticleSwooshShaders.hpp Shaders/CParticleSwooshShaders.cpp + Shaders/CFluidPlaneShader.hpp Shaders/CFluidPlaneShader.cpp + Shaders/CAABoxShader.hpp Shaders/CAABoxShader.cpp + Shaders/CWorldShadowShader.hpp Shaders/CWorldShadowShader.cpp + Shaders/CEnvFxShaders.hpp Shaders/CEnvFxShaders.cpp) runtime_add_list(Graphics GRAPHICS_SOURCES) diff --git a/Runtime/Graphics/CModel.hpp b/Runtime/Graphics/CModel.hpp index b049f686b..40f808ae3 100644 --- a/Runtime/Graphics/CModel.hpp +++ b/Runtime/Graphics/CModel.hpp @@ -201,8 +201,7 @@ public: const zeus::CAABox& aabb, u8 renderMask, int numInsts); static void MakeTexturesFromMats(const MaterialSet& matSet, - std::unordered_map>& toksOut, - IObjectStore& store); + std::unordered_map>& toksOut, IObjectStore& store); void MakeTexturesFromMats(std::unordered_map>& toksOut, IObjectStore& store); bool IsOpaque() const { return x3c_firstSortedSurface == nullptr; } diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 039dd32e9..46b6039df 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -244,7 +244,8 @@ GeometryUniformLayout::GeometryUniformLayout(const CModel* model, const Material } } -CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, boo::IGraphicsDataFactory::Context* ctx) { +CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, + boo::IGraphicsDataFactory::Context* ctx) { OPTICK_EVENT(); if (!x40_24_texturesLoaded && !g_DummyTextures) { return nullptr; @@ -370,10 +371,8 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, b EExtendedShader idx{}; for (const auto& pipeline : *pipelines) { - if (idx == EExtendedShader::ThermalModel || - idx == EExtendedShader::ThermalModelNoZTestNoZWrite || - idx == EExtendedShader::ThermalStatic || - idx == EExtendedShader::ThermalStaticNoZWrite) { + if (idx == EExtendedShader::ThermalModel || idx == EExtendedShader::ThermalModelNoZTestNoZWrite || + idx == EExtendedShader::ThermalStatic || idx == EExtendedShader::ThermalStaticNoZWrite) { texs[8] = g_Renderer->x220_sphereRamp.get(); } else if (idx == EExtendedShader::MorphBallShadow) { texs[8] = g_Renderer->m_ballShadowId.get(); @@ -390,7 +389,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, b else texs[8] = g_Renderer->x220_sphereRamp.get(); } else if (hecl::com_cubemaps->toBoolean() && (idx == EExtendedShader::LightingCubeReflection || - idx == EExtendedShader::LightingCubeReflectionWorldShadow)) { + idx == EExtendedShader::LightingCubeReflectionWorldShadow)) { if (m_lastDrawnReflectionCube) texs[11] = m_lastDrawnReflectionCube.get(); else @@ -404,7 +403,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, b } return true; }; - + if (ctx) { withContext(*ctx); } else { @@ -588,9 +587,8 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data, if (intermediateExtended == EExtendedShader::Lighting) { /* Transform lighting into thermal if the thermal visor is active */ if (g_Renderer->IsThermalVisorHotPass()) - return flags.m_noZTest - ? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite - : (noZWrite ? EExtendedShader::ThermalStaticNoZWrite : EExtendedShader::ThermalStatic); + return flags.m_noZTest ? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite + : (noZWrite ? EExtendedShader::ThermalStaticNoZWrite : EExtendedShader::ThermalStatic); else if (g_Renderer->IsThermalVisorActive()) return EExtendedShader::ThermalCold; if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Opaque) { @@ -600,17 +598,17 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data, extended = EExtendedShader::ForcedAdditiveNoZWriteDepthGreater; else extended = - flags.m_noCull - ? (noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull) - : (noZWrite ? EExtendedShader::ForcedAdditiveNoZWrite : EExtendedShader::ForcedAdditive); + flags.m_noCull + ? (noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull) + : (noZWrite ? EExtendedShader::ForcedAdditiveNoZWrite : EExtendedShader::ForcedAdditive); } else if (flags.x0_blendMode > 4) { extended = flags.m_noCull - ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) - : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::ForcedAlpha); + ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) + : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::ForcedAlpha); } else { extended = flags.m_noCull - ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) - : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::Lighting); + ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) + : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::Lighting); } } else if (flags.m_noCull && noZWrite) { /* Substitute no-cull,no-zwrite pipeline if available */ @@ -1002,7 +1000,8 @@ boo::ObjToken CBooModel::UpdateUniformData(const CModelFl } /* Invalidate instances if new reflection cube being drawn */ - if (hecl::com_cubemaps->toBoolean() && (flags.m_extendedShader == EExtendedShader::LightingCubeReflection || + if (hecl::com_cubemaps->toBoolean() && + (flags.m_extendedShader == EExtendedShader::LightingCubeReflection || flags.m_extendedShader == EExtendedShader::LightingCubeReflectionWorldShadow) && m_lastDrawnReflectionCube != g_reflectionCube) { m_lastDrawnReflectionCube = g_reflectionCube; diff --git a/Runtime/Graphics/CMoviePlayer.cpp b/Runtime/Graphics/CMoviePlayer.cpp index 9c4865c90..37aab6c64 100644 --- a/Runtime/Graphics/CMoviePlayer.cpp +++ b/Runtime/Graphics/CMoviePlayer.cpp @@ -147,10 +147,7 @@ u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo) } CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bool deinterlace) -: CDvdFile(path) -, xec_preLoadSeconds(preLoadSeconds) -, xf4_24_loop(loop) -, m_deinterlace(deinterlace) { +: CDvdFile(path), xec_preLoadSeconds(preLoadSeconds), xf4_24_loop(loop), m_deinterlace(deinterlace) { /* Read THP header information */ u8 buf[64]; SyncRead(buf, 64); diff --git a/Runtime/Graphics/CRainSplashGenerator.cpp b/Runtime/Graphics/CRainSplashGenerator.cpp index 18abf0707..0dc3895c7 100644 --- a/Runtime/Graphics/CRainSplashGenerator.cpp +++ b/Runtime/Graphics/CRainSplashGenerator.cpp @@ -158,8 +158,7 @@ u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const std::vector maxDist && vert.second.dot(zeus::skUp) >= 0.f && - (vert.first.z() <= 0.f || vert.first.z() > minZ)) { + if (distSq > maxDist && vert.second.dot(zeus::skUp) >= 0.f && (vert.first.z() <= 0.f || vert.first.z() > minZ)) { nextPt = idx; maxDist = distSq; } diff --git a/Runtime/Graphics/CSimpleShadow.cpp b/Runtime/Graphics/CSimpleShadow.cpp index c3953bfa7..5048a9103 100644 --- a/Runtime/Graphics/CSimpleShadow.cpp +++ b/Runtime/Graphics/CSimpleShadow.cpp @@ -59,8 +59,8 @@ void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform& if (height > 0.1f + halfHeight) { TUniqueId cid = kInvalidUniqueId; EntityList nearList; - CRayCastResult resD = CGameCollision::RayDynamicIntersection( - mgr, cid, pos, zeus::skDown, x40_maxObjHeight, CMaterialFilter::skPassEverything, nearList); + CRayCastResult resD = CGameCollision::RayDynamicIntersection(mgr, cid, pos, zeus::skDown, x40_maxObjHeight, + CMaterialFilter::skPassEverything, nearList); if (resD.IsValid() && resD.GetT() < height) { x48_24_collision = true; height = resD.GetT(); diff --git a/Runtime/Graphics/CSkinnedModel.cpp b/Runtime/Graphics/CSkinnedModel.cpp index 343166c3d..65eba6f43 100644 --- a/Runtime/Graphics/CSkinnedModel.cpp +++ b/Runtime/Graphics/CSkinnedModel.cpp @@ -29,8 +29,7 @@ CSkinnedModel::CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinR store.GetObj(SObjectTag{FOURCC('CINF'), layoutInfo}), shaderIdx, drawInsts) {} void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags, - const std::optional& morphEffect, - const float* morphMagnitudes) { + const std::optional& morphEffect, const float* morphMagnitudes) { if (morphEffect || g_PointGenFunc) { if (boo::ObjToken vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr)) { x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model); diff --git a/Runtime/Graphics/CTextureBoo.cpp b/Runtime/Graphics/CTextureBoo.cpp index 23c79912a..2bfc78089 100644 --- a/Runtime/Graphics/CTextureBoo.cpp +++ b/Runtime/Graphics/CTextureBoo.cpp @@ -894,7 +894,7 @@ CFactoryFnReturn FTextureFactory(const metaforce::SObjectTag& tag, std::unique_p u32 u32Owned = vparms.GetOwnedObj(); const CTextureInfo* inf = nullptr; if (g_TextureCache) - inf = g_TextureCache->GetTextureInfo(tag.id); + inf = g_TextureCache->GetTextureInfo(tag.id); return TToken::GetIObjObjectFor( std::make_unique(std::move(in), len, u32Owned == SBIG('OTEX'), inf)); } diff --git a/Runtime/Graphics/Shaders/CColoredStripShader.cpp b/Runtime/Graphics/Shaders/CColoredStripShader.cpp index 7bbae149d..1c2c8f716 100644 --- a/Runtime/Graphics/Shaders/CColoredStripShader.cpp +++ b/Runtime/Graphics/Shaders/CColoredStripShader.cpp @@ -86,4 +86,4 @@ void CColoredStripShader::draw(const zeus::CColor& color, size_t numVerts, const CGraphics::DrawArray(0, numVerts); } -} +} // namespace metaforce diff --git a/Runtime/Graphics/Shaders/CColoredStripShader.hpp b/Runtime/Graphics/Shaders/CColoredStripShader.hpp index 06d57344a..620f7fdc6 100644 --- a/Runtime/Graphics/Shaders/CColoredStripShader.hpp +++ b/Runtime/Graphics/Shaders/CColoredStripShader.hpp @@ -9,12 +9,8 @@ namespace metaforce { class CColoredStripShader { public: - enum class Mode { - Alpha, - Additive, - FullAdditive, - Subtractive - }; + enum class Mode { Alpha, Additive, FullAdditive, Subtractive }; + private: struct Uniform { zeus::CMatrix4f m_matrix; @@ -27,6 +23,7 @@ private: void BuildResources(boo::IGraphicsDataFactory::Context& ctx, size_t maxVerts, Mode mode, boo::ObjToken tex); + public: struct Vert { zeus::CVector3f m_pos; @@ -41,4 +38,4 @@ public: void draw(const zeus::CColor& color, size_t numVerts, const Vert* verts); }; -} +} // namespace metaforce diff --git a/Runtime/Graphics/Shaders/CElementGenShaders.cpp b/Runtime/Graphics/Shaders/CElementGenShaders.cpp index b0fc9bc61..6d21076a6 100644 --- a/Runtime/Graphics/Shaders/CElementGenShaders.cpp +++ b/Runtime/Graphics/Shaders/CElementGenShaders.cpp @@ -63,33 +63,57 @@ void CElementGenShaders::Initialize() { } void CElementGenShaders::Shutdown() { - for (auto& s : m_texZTestZWrite) s.reset(); - for (auto& s : m_texNoZTestZWrite) s.reset(); - for (auto& s : m_texZTestNoZWrite) s.reset(); - for (auto& s : m_texNoZTestNoZWrite) s.reset(); - for (auto& s : m_texAdditiveZTest) s.reset(); - for (auto& s : m_texAdditiveNoZTest) s.reset(); - for (auto& s : m_texRedToAlphaZTest) s.reset(); - for (auto& s : m_texRedToAlphaNoZTest) s.reset(); - for (auto& s : m_texZTestNoZWriteSub) s.reset(); - for (auto& s : m_texNoZTestNoZWriteSub) s.reset(); - for (auto& s : m_texRedToAlphaZTestSub) s.reset(); - for (auto& s : m_texRedToAlphaNoZTestSub) s.reset(); + for (auto& s : m_texZTestZWrite) + s.reset(); + for (auto& s : m_texNoZTestZWrite) + s.reset(); + for (auto& s : m_texZTestNoZWrite) + s.reset(); + for (auto& s : m_texNoZTestNoZWrite) + s.reset(); + for (auto& s : m_texAdditiveZTest) + s.reset(); + for (auto& s : m_texAdditiveNoZTest) + s.reset(); + for (auto& s : m_texRedToAlphaZTest) + s.reset(); + for (auto& s : m_texRedToAlphaNoZTest) + s.reset(); + for (auto& s : m_texZTestNoZWriteSub) + s.reset(); + for (auto& s : m_texNoZTestNoZWriteSub) + s.reset(); + for (auto& s : m_texRedToAlphaZTestSub) + s.reset(); + for (auto& s : m_texRedToAlphaNoZTestSub) + s.reset(); - for (auto& s : m_indTexZWrite) s.reset(); - for (auto& s : m_indTexNoZWrite) s.reset(); - for (auto& s : m_indTexAdditive) s.reset(); + for (auto& s : m_indTexZWrite) + s.reset(); + for (auto& s : m_indTexNoZWrite) + s.reset(); + for (auto& s : m_indTexAdditive) + s.reset(); - for (auto& s : m_cindTexZWrite) s.reset(); - for (auto& s : m_cindTexNoZWrite) s.reset(); - for (auto& s : m_cindTexAdditive) s.reset(); + for (auto& s : m_cindTexZWrite) + s.reset(); + for (auto& s : m_cindTexNoZWrite) + s.reset(); + for (auto& s : m_cindTexAdditive) + s.reset(); - for (auto& s : m_noTexZTestZWrite) s.reset(); - for (auto& s : m_noTexNoZTestZWrite) s.reset(); - for (auto& s : m_noTexZTestNoZWrite) s.reset(); - for (auto& s : m_noTexNoZTestNoZWrite) s.reset(); - for (auto& s : m_noTexAdditiveZTest) s.reset(); - for (auto& s : m_noTexAdditiveNoZTest) s.reset(); + for (auto& s : m_noTexZTestZWrite) + s.reset(); + for (auto& s : m_noTexNoZTestZWrite) + s.reset(); + for (auto& s : m_noTexZTestNoZWrite) + s.reset(); + for (auto& s : m_noTexNoZTestNoZWrite) + s.reset(); + for (auto& s : m_noTexAdditiveZTest) + s.reset(); + for (auto& s : m_noTexAdditiveNoZTest) + s.reset(); } CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen) { diff --git a/Runtime/Graphics/Shaders/CFluidPlaneShader.hpp b/Runtime/Graphics/Shaders/CFluidPlaneShader.hpp index 258b86e7a..2b78d4cb8 100644 --- a/Runtime/Graphics/Shaders/CFluidPlaneShader.hpp +++ b/Runtime/Graphics/Shaders/CFluidPlaneShader.hpp @@ -168,8 +168,7 @@ public: void doneDrawing() { m_lastBind = -1; } void loadVerts(const std::vector& verts, const std::vector& pVerts); bool isReady() const { - return m_pipelines.m_regular->isReady() && - (!m_pipelines.m_tessellation || m_pipelines.m_tessellation->isReady()); + return m_pipelines.m_regular->isReady() && (!m_pipelines.m_tessellation || m_pipelines.m_tessellation->isReady()); } static void Shutdown(); diff --git a/Runtime/Graphics/Shaders/CLineRendererShaders.cpp b/Runtime/Graphics/Shaders/CLineRendererShaders.cpp index d3145b43d..05b4c3dc8 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShaders.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShaders.cpp @@ -33,15 +33,24 @@ void CLineRendererShaders::Initialize() { } void CLineRendererShaders::Shutdown() { - for (auto& s : m_texAlpha) s.reset(); - for (auto& s : m_texAdditive) s.reset(); - for (auto& s : m_noTexAlpha) s.reset(); - for (auto& s : m_noTexAdditive) s.reset(); - for (auto& s : m_texAlphaZ) s.reset(); - for (auto& s : m_texAdditiveZ) s.reset(); - for (auto& s : m_noTexAlphaZ) s.reset(); - for (auto& s : m_noTexAdditiveZ) s.reset(); - for (auto& s : m_noTexAlphaZGEqual) s.reset(); + for (auto& s : m_texAlpha) + s.reset(); + for (auto& s : m_texAdditive) + s.reset(); + for (auto& s : m_noTexAlpha) + s.reset(); + for (auto& s : m_noTexAdditive) + s.reset(); + for (auto& s : m_texAlphaZ) + s.reset(); + for (auto& s : m_texAdditiveZ) + s.reset(); + for (auto& s : m_noTexAlphaZ) + s.reset(); + for (auto& s : m_noTexAdditiveZ) + s.reset(); + for (auto& s : m_noTexAlphaZGEqual) + s.reset(); } void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer, diff --git a/Runtime/Graphics/Shaders/CModelShaders.cpp b/Runtime/Graphics/Shaders/CModelShaders.cpp index ba66992c8..f2dd04f2f 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.cpp +++ b/Runtime/Graphics/Shaders/CModelShaders.cpp @@ -93,11 +93,11 @@ static std::array g_ {1, ThermalTextures.data(), hecl::Backend::BlendFactor::One, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None, hecl::Backend::CullMode::Backface, true, false, false, true}, /* Thermal static shading */ - {0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, - hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, false, true, false, false, true}, + {0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Backface, false, false, false, true, false, false, true}, /* Thermal static shading without Z-write */ - {0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, - hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, true, false, false, true, false, false, false}, + {0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Backface, true, false, false, true, false, false, false}, /* Forced alpha shading */ {0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true}, @@ -162,8 +162,8 @@ static std::array g_ {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface}, /* Normal lit shading with alpha without Z-write or depth test */ - {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, - hecl::Backend::ZTest::None, hecl::Backend::CullMode::Backface, true}, + {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::None, + hecl::Backend::CullMode::Backface, true}, /* Normal lit shading with cube reflection */ {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true}, diff --git a/Runtime/Graphics/Shaders/CParticleSwooshShaders.cpp b/Runtime/Graphics/Shaders/CParticleSwooshShaders.cpp index 4003673ae..e33e3d7a1 100644 --- a/Runtime/Graphics/Shaders/CParticleSwooshShaders.cpp +++ b/Runtime/Graphics/Shaders/CParticleSwooshShaders.cpp @@ -39,14 +39,22 @@ void CParticleSwooshShaders::Initialize() { } void CParticleSwooshShaders::Shutdown() { - for (auto& s : m_texZWrite) s.reset(); - for (auto& s : m_texNoZWrite) s.reset(); - for (auto& s : m_texAdditiveZWrite) s.reset(); - for (auto& s : m_texAdditiveNoZWrite) s.reset(); - for (auto& s : m_noTexZWrite) s.reset(); - for (auto& s : m_noTexNoZWrite) s.reset(); - for (auto& s : m_noTexAdditiveZWrite) s.reset(); - for (auto& s : m_noTexAdditiveNoZWrite) s.reset(); + for (auto& s : m_texZWrite) + s.reset(); + for (auto& s : m_texNoZWrite) + s.reset(); + for (auto& s : m_texAdditiveZWrite) + s.reset(); + for (auto& s : m_texAdditiveNoZWrite) + s.reset(); + for (auto& s : m_noTexZWrite) + s.reset(); + for (auto& s : m_noTexNoZWrite) + s.reset(); + for (auto& s : m_noTexAdditiveZWrite) + s.reset(); + for (auto& s : m_noTexAdditiveNoZWrite) + s.reset(); } CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) { diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index f975d03fc..fb3c972f7 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -309,9 +309,9 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr) { } x1f0_xrayRetAngle = - zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle).asRel(); - x1ec_seekerAngle = zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle). - asRel(); + zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle).asRel(); + x1ec_seekerAngle = + zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle).asRel(); } void CTargetReticleRenderState::InterpolateWithClamp(const CTargetReticleRenderState& a, CTargetReticleRenderState& out, @@ -411,8 +411,8 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager item.x10_rotAng = zeus::CRelAngle(item.x18_offshootAngleDelta * offshoot + item.xc_offshootBaseAngle).asRel(); } xc4_chargeGauge.x10_rotAng = - zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot + xc4_chargeGauge.xc_offshootBaseAngle). - asRel(); + zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot + xc4_chargeGauge.xc_offshootBaseAngle) + .asRel(); } } diff --git a/Runtime/GuiSys/CConsoleOutputWindow.cpp b/Runtime/GuiSys/CConsoleOutputWindow.cpp index ee7cb8fbf..653d5a402 100644 --- a/Runtime/GuiSys/CConsoleOutputWindow.cpp +++ b/Runtime/GuiSys/CConsoleOutputWindow.cpp @@ -10,7 +10,7 @@ CIOWin::EMessageReturn CConsoleOutputWindow::OnMessage(const CArchitectureMessag } void CConsoleOutputWindow::Draw() { - //SCOPED_GRAPHICS_DEBUG_GROUP("CConsoleOutputWindow::Draw", zeus::skGreen); + // SCOPED_GRAPHICS_DEBUG_GROUP("CConsoleOutputWindow::Draw", zeus::skGreen); } } // namespace metaforce diff --git a/Runtime/GuiSys/CErrorOutputWindow.cpp b/Runtime/GuiSys/CErrorOutputWindow.cpp index 0bccee052..9e6f1fe88 100644 --- a/Runtime/GuiSys/CErrorOutputWindow.cpp +++ b/Runtime/GuiSys/CErrorOutputWindow.cpp @@ -17,7 +17,7 @@ CIOWin::EMessageReturn CErrorOutputWindow::OnMessage(const CArchitectureMessage& } void CErrorOutputWindow::Draw() { - //SCOPED_GRAPHICS_DEBUG_GROUP("CErrorOutputWindow::Draw", zeus::skGreen); + // SCOPED_GRAPHICS_DEBUG_GROUP("CErrorOutputWindow::Draw", zeus::skGreen); } } // namespace metaforce diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp index 91cfc8d4a..e7186b17e 100644 --- a/Runtime/GuiSys/CGuiFrame.cpp +++ b/Runtime/GuiSys/CGuiFrame.cpp @@ -126,9 +126,7 @@ void CGuiFrame::SetMaxAspect(float c) { CGuiSys::ViewportResizeFrame(this); } -void CGuiFrame::Reset() { - x10_rootWidget->Reset(ETraversalMode::Children); -} +void CGuiFrame::Reset() { x10_rootWidget->Reset(ETraversalMode::Children); } void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); } @@ -200,8 +198,7 @@ void CGuiFrame::ProcessUserInput(const CFinalInput& input) const { bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDrawParms& parms) { if (const auto& kbm = input.GetKBM()) { - zeus::CVector2f point(kbm->m_mouseCoord.norm[0] * 2.f - 1.f, - kbm->m_mouseCoord.norm[1] * 2.f - 1.f); + zeus::CVector2f point(kbm->m_mouseCoord.norm[0] * 2.f - 1.f, kbm->m_mouseCoord.norm[1] * 2.f - 1.f); CGuiWidget* hit = BestCursorHit(point, parms); if (hit != m_lastMouseOverWidget) { if (m_inMouseDown && m_mouseDownWidget != hit) { diff --git a/Runtime/GuiSys/CGuiFrame.hpp b/Runtime/GuiSys/CGuiFrame.hpp index 6a2559394..12c32bce7 100644 --- a/Runtime/GuiSys/CGuiFrame.hpp +++ b/Runtime/GuiSys/CGuiFrame.hpp @@ -85,12 +85,8 @@ public: void SetMouseOverChangeCallback(std::function&& cb) { m_mouseOverChangeCb = std::move(cb); } - void SetMouseDownCallback(std::function&& cb) { - m_mouseDownCb = std::move(cb); - } - void SetMouseUpCallback(std::function&& cb) { - m_mouseUpCb = std::move(cb); - } + void SetMouseDownCallback(std::function&& cb) { m_mouseDownCb = std::move(cb); } + void SetMouseUpCallback(std::function&& cb) { m_mouseUpCb = std::move(cb); } void SetMouseScrollCallback(std::function&& cb) { m_mouseScrollCb = std::move(cb); } diff --git a/Runtime/GuiSys/CGuiObject.cpp b/Runtime/GuiSys/CGuiObject.cpp index b963011c4..010b03f21 100644 --- a/Runtime/GuiSys/CGuiObject.cpp +++ b/Runtime/GuiSys/CGuiObject.cpp @@ -19,8 +19,8 @@ void CGuiObject::Draw(const CGuiWidgetDrawParms& parms) { } void CGuiObject::MoveInWorld(const zeus::CVector3f& vec) { - //if (x64_parent) - // x64_parent->RotateW2O(vec); + // if (x64_parent) + // x64_parent->RotateW2O(vec); x4_localXF.origin += vec; RecalculateTransforms(); } diff --git a/Runtime/GuiSys/CGuiTextPane.cpp b/Runtime/GuiSys/CGuiTextPane.cpp index 8cff5cf46..6ec8effe6 100644 --- a/Runtime/GuiSys/CGuiTextPane.cpp +++ b/Runtime/GuiSys/CGuiTextPane.cpp @@ -35,9 +35,7 @@ void CGuiTextPane::Update(float dt) { xd4_textSupport.Update(dt); } -bool CGuiTextPane::GetIsFinishedLoadingWidgetSpecific() { - return xd4_textSupport.GetIsTextSupportFinishedLoading(); -} +bool CGuiTextPane::GetIsFinishedLoadingWidgetSpecific() { return xd4_textSupport.GetIsTextSupportFinishedLoading(); } void CGuiTextPane::SetDimensions(const zeus::CVector2f& dim, bool initVBO) { CGuiPane::SetDimensions(dim, initVBO); diff --git a/Runtime/GuiSys/CGuiWidget.cpp b/Runtime/GuiSys/CGuiWidget.cpp index a3ec88dc2..c3859f312 100644 --- a/Runtime/GuiSys/CGuiWidget.cpp +++ b/Runtime/GuiSys/CGuiWidget.cpp @@ -64,7 +64,8 @@ void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWid in.readUint16Big(); if (isWorker) { if (!parent->AddWorkerWidget(this)) { - Log.report(logvisor::Warning, FMT_STRING("Warning: Discarding useless worker id. Parent is not a compound widget.")); + Log.report(logvisor::Warning, + FMT_STRING("Warning: Discarding useless worker id. Parent is not a compound widget.")); xb4_workerId = -1; } } diff --git a/Runtime/GuiSys/CHudThreatInterface.cpp b/Runtime/GuiSys/CHudThreatInterface.cpp index 25b6fcdae..30fb727a1 100644 --- a/Runtime/GuiSys/CHudThreatInterface.cpp +++ b/Runtime/GuiSys/CHudThreatInterface.cpp @@ -86,7 +86,8 @@ void CHudThreatInterface::Update(float dt) { if (x70_textpane_threatdigits) { if (x10_threatDist < maxThreatEnergy) { x70_textpane_threatdigits->SetIsVisible(true); - x70_textpane_threatdigits->TextSupport().SetText(fmt::format(FMT_STRING("{:01.1f}"), std::max(0.f, x10_threatDist))); + x70_textpane_threatdigits->TextSupport().SetText( + fmt::format(FMT_STRING("{:01.1f}"), std::max(0.f, x10_threatDist))); } else { x70_textpane_threatdigits->SetIsVisible(false); } diff --git a/Runtime/GuiSys/CMakeLists.txt b/Runtime/GuiSys/CMakeLists.txt index 5bc65002a..7adfe4402 100644 --- a/Runtime/GuiSys/CMakeLists.txt +++ b/Runtime/GuiSys/CMakeLists.txt @@ -1,54 +1,54 @@ set(GUISYS_SOURCES - CSplashScreen.hpp CSplashScreen.cpp - CGuiObject.hpp CGuiObject.cpp - CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp - CAuiEnergyBarT01.hpp CAuiEnergyBarT01.cpp - CAuiImagePane.hpp CAuiImagePane.cpp - CAuiMeter.hpp CAuiMeter.cpp - CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp - CErrorOutputWindow.hpp CErrorOutputWindow.cpp - CGuiCamera.hpp CGuiCamera.cpp - CGuiFrame.hpp CGuiFrame.cpp - CGuiLight.hpp CGuiLight.cpp - CGuiModel.hpp CGuiModel.cpp - CGuiSliderGroup.hpp CGuiSliderGroup.cpp - CGuiSys.hpp CGuiSys.cpp - CGuiTableGroup.hpp CGuiTableGroup.cpp - CGuiTextPane.hpp CGuiTextPane.cpp - CGuiTextSupport.hpp CGuiTextSupport.cpp - CGuiWidget.hpp CGuiWidget.cpp - CGuiWidgetDrawParms.hpp - CSplashScreen.hpp CSplashScreen.cpp - CGuiCompoundWidget.hpp CGuiCompoundWidget.cpp - CSaveableState.hpp CSaveableState.cpp - CDrawStringOptions.hpp - CRasterFont.hpp CRasterFont.cpp - CGuiGroup.hpp CGuiGroup.cpp - CGuiWidgetIdDB.hpp CGuiWidgetIdDB.cpp - CGuiHeadWidget.hpp CGuiHeadWidget.cpp - CGuiPane.hpp CGuiPane.cpp - CFontRenderState.hpp CFontRenderState.cpp - CTextExecuteBuffer.hpp CTextExecuteBuffer.cpp - CTextRenderBuffer.hpp CTextRenderBuffer.cpp - CInstruction.hpp CInstruction.cpp - CTextParser.hpp CTextParser.cpp - CWordBreakTables.hpp CWordBreakTables.cpp - CFontImageDef.hpp CFontImageDef.cpp - CStringTable.hpp CStringTable.cpp - CTargetingManager.hpp CTargetingManager.cpp - CCompoundTargetReticle.hpp CCompoundTargetReticle.cpp - COrbitPointMarker.hpp COrbitPointMarker.cpp - CHudEnergyInterface.hpp CHudEnergyInterface.cpp - CHudBossEnergyInterface.hpp CHudBossEnergyInterface.cpp - CHudThreatInterface.hpp CHudThreatInterface.cpp - CHudMissileInterface.hpp CHudMissileInterface.cpp - CHudFreeLookInterface.hpp CHudFreeLookInterface.cpp - CHudDecoInterface.hpp CHudDecoInterface.cpp - CHudHelmetInterface.hpp CHudHelmetInterface.cpp - CHudVisorBeamMenu.hpp CHudVisorBeamMenu.cpp - CHudRadarInterface.hpp CHudRadarInterface.cpp - CHudBallInterface.hpp CHudBallInterface.cpp - CHudInterface.hpp - CScanDisplay.hpp CScanDisplay.cpp) + CSplashScreen.hpp CSplashScreen.cpp + CGuiObject.hpp CGuiObject.cpp + CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp + CAuiEnergyBarT01.hpp CAuiEnergyBarT01.cpp + CAuiImagePane.hpp CAuiImagePane.cpp + CAuiMeter.hpp CAuiMeter.cpp + CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp + CErrorOutputWindow.hpp CErrorOutputWindow.cpp + CGuiCamera.hpp CGuiCamera.cpp + CGuiFrame.hpp CGuiFrame.cpp + CGuiLight.hpp CGuiLight.cpp + CGuiModel.hpp CGuiModel.cpp + CGuiSliderGroup.hpp CGuiSliderGroup.cpp + CGuiSys.hpp CGuiSys.cpp + CGuiTableGroup.hpp CGuiTableGroup.cpp + CGuiTextPane.hpp CGuiTextPane.cpp + CGuiTextSupport.hpp CGuiTextSupport.cpp + CGuiWidget.hpp CGuiWidget.cpp + CGuiWidgetDrawParms.hpp + CSplashScreen.hpp CSplashScreen.cpp + CGuiCompoundWidget.hpp CGuiCompoundWidget.cpp + CSaveableState.hpp CSaveableState.cpp + CDrawStringOptions.hpp + CRasterFont.hpp CRasterFont.cpp + CGuiGroup.hpp CGuiGroup.cpp + CGuiWidgetIdDB.hpp CGuiWidgetIdDB.cpp + CGuiHeadWidget.hpp CGuiHeadWidget.cpp + CGuiPane.hpp CGuiPane.cpp + CFontRenderState.hpp CFontRenderState.cpp + CTextExecuteBuffer.hpp CTextExecuteBuffer.cpp + CTextRenderBuffer.hpp CTextRenderBuffer.cpp + CInstruction.hpp CInstruction.cpp + CTextParser.hpp CTextParser.cpp + CWordBreakTables.hpp CWordBreakTables.cpp + CFontImageDef.hpp CFontImageDef.cpp + CStringTable.hpp CStringTable.cpp + CTargetingManager.hpp CTargetingManager.cpp + CCompoundTargetReticle.hpp CCompoundTargetReticle.cpp + COrbitPointMarker.hpp COrbitPointMarker.cpp + CHudEnergyInterface.hpp CHudEnergyInterface.cpp + CHudBossEnergyInterface.hpp CHudBossEnergyInterface.cpp + CHudThreatInterface.hpp CHudThreatInterface.cpp + CHudMissileInterface.hpp CHudMissileInterface.cpp + CHudFreeLookInterface.hpp CHudFreeLookInterface.cpp + CHudDecoInterface.hpp CHudDecoInterface.cpp + CHudHelmetInterface.hpp CHudHelmetInterface.cpp + CHudVisorBeamMenu.hpp CHudVisorBeamMenu.cpp + CHudRadarInterface.hpp CHudRadarInterface.cpp + CHudBallInterface.hpp CHudBallInterface.cpp + CHudInterface.hpp + CScanDisplay.hpp CScanDisplay.cpp) runtime_add_list(GuiSys GUISYS_SOURCES) diff --git a/Runtime/GuiSys/COrbitPointMarker.cpp b/Runtime/GuiSys/COrbitPointMarker.cpp index a63cc9a24..c65226029 100644 --- a/Runtime/GuiSys/COrbitPointMarker.cpp +++ b/Runtime/GuiSys/COrbitPointMarker.cpp @@ -74,8 +74,7 @@ void COrbitPointMarker::Draw(const CStateManager& mgr) const { zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); CGraphics::SetViewPointMatrix(camXf); zeus::CFrustum frustum = mgr.SetupDrawFrustum(g_Viewport); - frustum.updatePlanes(camXf, zeus::SProjPersp(zeus::degToRad(curCam->GetFov()), - g_Viewport.aspect, 1.f, 100.f)); + frustum.updatePlanes(camXf, zeus::SProjPersp(zeus::degToRad(curCam->GetFov()), g_Viewport.aspect, 1.f, 100.f)); g_Renderer->SetClippingPlanes(frustum); g_Renderer->SetPerspective(curCam->GetFov(), g_Viewport.x8_width, g_Viewport.xc_height, curCam->GetNearClipDistance(), curCam->GetFarClipDistance()); diff --git a/Runtime/GuiSys/CRasterFont.hpp b/Runtime/GuiSys/CRasterFont.hpp index 7ddd37f8c..45b0dcf04 100644 --- a/Runtime/GuiSys/CRasterFont.hpp +++ b/Runtime/GuiSys/CRasterFont.hpp @@ -114,7 +114,7 @@ public: s32 GetMonoWidth() const { return x4_monoWidth; } s32 GetMonoHeight() const { return x8_monoHeight; } EColorType GetMode() const { - switch(x2c_mode) { + switch (x2c_mode) { case CTexture::EFontType::OneLayer: case CTexture::EFontType::TwoLayers: case CTexture::EFontType::FourLayers: @@ -148,9 +148,7 @@ public: const char16_t* str, int len) const; const CGlyph* GetGlyph(char16_t chr) const { return InternalGetGlyph(chr); } void GetSize(const CDrawStringOptions& opts, int& width, int& height, const char16_t* str, int len) const; - const boo::ObjToken& GetTexture() { - return x80_texture->GetFontTexture(x2c_mode); - } + const boo::ObjToken& GetTexture() { return x80_texture->GetFontTexture(x2c_mode); } bool IsFinishedLoading() const; }; diff --git a/Runtime/GuiSys/CTargetingManager.cpp b/Runtime/GuiSys/CTargetingManager.cpp index d2b536e57..1dd481f8c 100644 --- a/Runtime/GuiSys/CTargetingManager.cpp +++ b/Runtime/GuiSys/CTargetingManager.cpp @@ -26,8 +26,7 @@ void CTargetingManager::Draw(const CStateManager& mgr, bool hideLockon) { zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); CGraphics::SetViewPointMatrix(camXf); zeus::CFrustum frustum; - frustum.updatePlanes(camXf, zeus::SProjPersp(zeus::degToRad(curCam->GetFov()), - g_Viewport.aspect, 1.f, 100.f)); + frustum.updatePlanes(camXf, zeus::SProjPersp(zeus::degToRad(curCam->GetFov()), g_Viewport.aspect, 1.f, 100.f)); g_Renderer->SetClippingPlanes(frustum); g_Renderer->SetPerspective(curCam->GetFov(), g_Viewport.x8_width, g_Viewport.xc_height, curCam->GetNearClipDistance(), curCam->GetFarClipDistance()); diff --git a/Runtime/IFactory.hpp b/Runtime/IFactory.hpp index 3039f4816..d82e1247d 100644 --- a/Runtime/IFactory.hpp +++ b/Runtime/IFactory.hpp @@ -16,10 +16,12 @@ class IDvdRequest; class IObj; using CFactoryFnReturn = std::unique_ptr; -using FFactoryFunc = std::function; -using FMemFactoryFunc = std::function&& in, u32 len, - const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef)>; +using FFactoryFunc = + std::function; +using FMemFactoryFunc = + std::function&& in, u32 len, + const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef)>; class IFactory { public: diff --git a/Runtime/Input/CMakeLists.txt b/Runtime/Input/CMakeLists.txt index 260c262e8..809f890f1 100644 --- a/Runtime/Input/CMakeLists.txt +++ b/Runtime/Input/CMakeLists.txt @@ -1,12 +1,12 @@ set(INPUT_SOURCES - IController.hpp - CKeyboardMouseController.hpp - ControlMapper.hpp ControlMapper.cpp - CInputGenerator.hpp CInputGenerator.cpp - CFinalInput.hpp CFinalInput.cpp - CRumbleManager.hpp CRumbleManager.cpp - CRumbleGenerator.hpp CRumbleGenerator.cpp - CRumbleVoice.hpp CRumbleVoice.cpp - RumbleFxTable.hpp RumbleFxTable.cpp) + IController.hpp + CKeyboardMouseController.hpp + ControlMapper.hpp ControlMapper.cpp + CInputGenerator.hpp CInputGenerator.cpp + CFinalInput.hpp CFinalInput.cpp + CRumbleManager.hpp CRumbleManager.cpp + CRumbleGenerator.hpp CRumbleGenerator.cpp + CRumbleVoice.hpp CRumbleVoice.cpp + RumbleFxTable.hpp RumbleFxTable.cpp) runtime_add_list(Input INPUT_SOURCES) diff --git a/Runtime/Input/CRumbleGenerator.cpp b/Runtime/Input/CRumbleGenerator.cpp index d778010c1..c9fe4be5f 100644 --- a/Runtime/Input/CRumbleGenerator.cpp +++ b/Runtime/Input/CRumbleGenerator.cpp @@ -4,9 +4,7 @@ namespace metaforce { -CRumbleGenerator::CRumbleGenerator() { - HardStopAll(); -} +CRumbleGenerator::CRumbleGenerator() { HardStopAll(); } CRumbleGenerator::~CRumbleGenerator() { HardStopAll(); } diff --git a/Runtime/Input/CRumbleVoice.cpp b/Runtime/Input/CRumbleVoice.cpp index 8981f14be..a6ac16b82 100644 --- a/Runtime/Input/CRumbleVoice.cpp +++ b/Runtime/Input/CRumbleVoice.cpp @@ -2,9 +2,7 @@ namespace metaforce { -CRumbleVoice::CRumbleVoice() : x0_datas(4), x10_deltas(4, SAdsrDelta::Stopped()) { - x20_handleIds.resize(4); -} +CRumbleVoice::CRumbleVoice() : x0_datas(4), x10_deltas(4, SAdsrDelta::Stopped()) { x20_handleIds.resize(4); } s16 CRumbleVoice::CreateRumbleHandle(s16 idx) { ++x2e_lastId; diff --git a/Runtime/Input/ControlMapper.cpp b/Runtime/Input/ControlMapper.cpp index e380daef6..167da4991 100644 --- a/Runtime/Input/ControlMapper.cpp +++ b/Runtime/Input/ControlMapper.cpp @@ -224,9 +224,7 @@ std::array skCommandFilterFlag{true}; void ControlMapper::SetCommandFiltered(ECommands cmd, bool filtered) { skCommandFilterFlag[size_t(cmd)] = filtered; } -void ControlMapper::ResetCommandFilters() { - skCommandFilterFlag.fill(true); -} +void ControlMapper::ResetCommandFilters() { skCommandFilterFlag.fill(true); } bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input) { if (!skCommandFilterFlag[size_t(cmd)]) { diff --git a/Runtime/Input/RumbleFxTable.hpp b/Runtime/Input/RumbleFxTable.hpp index 030d90386..3d6351294 100644 --- a/Runtime/Input/RumbleFxTable.hpp +++ b/Runtime/Input/RumbleFxTable.hpp @@ -9,4 +9,4 @@ using RumbleFXTable = std::array; extern const RumbleFXTable RumbleFxTable; -} +} // namespace metaforce diff --git a/Runtime/MP1/CArtifactDoll.cpp b/Runtime/MP1/CArtifactDoll.cpp index d9a38baf2..8107a458b 100644 --- a/Runtime/MP1/CArtifactDoll.cpp +++ b/Runtime/MP1/CArtifactDoll.cpp @@ -137,9 +137,8 @@ void CArtifactDoll::Draw(float alpha, const CStateManager& mgr, bool inArtifactC } void CArtifactDoll::UpdateActorLights() { - x10_lights[0] = CLight::BuildDirectional( - (zeus::skForward + 0.25f * zeus::skRight + 0.1f * zeus::skDown).normalized(), - zeus::skWhite); + x10_lights[0] = CLight::BuildDirectional((zeus::skForward + 0.25f * zeus::skRight + 0.1f * zeus::skDown).normalized(), + zeus::skWhite); x10_lights[1] = CLight::BuildDirectional(-zeus::skForward, zeus::skBlack); x20_actorLights->BuildFakeLightList(x10_lights, zeus::CColor(0.25f, 1.f)); } diff --git a/Runtime/MP1/CAutoSave.cpp b/Runtime/MP1/CAutoSave.cpp index cdd092e02..7aed19b2a 100644 --- a/Runtime/MP1/CAutoSave.cpp +++ b/Runtime/MP1/CAutoSave.cpp @@ -7,9 +7,7 @@ CAutoSave::CAutoSave() : CIOWin("AutoSave"sv), x14_savegameScreen(new CSaveGameScreen(ESaveContext::InGame, g_GameState->GetCardSerial())) { static_cast(g_Main)->RefreshGameState(); } -void CAutoSave::Draw() { - x14_savegameScreen->Draw(); -} +void CAutoSave::Draw() { x14_savegameScreen->Draw(); } CIOWin::EMessageReturn CAutoSave::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) { if (g_GameState->GetCardSerial() == 0ull) { return EMessageReturn ::RemoveIOWinAndExit; @@ -17,7 +15,7 @@ CIOWin::EMessageReturn CAutoSave::OnMessage(const CArchitectureMessage& msg, CAr if (msg.GetType() == EArchMsgType::UserInput) { x14_savegameScreen->ProcessUserInput(MakeMsg::GetParmUserInput(msg).x4_parm); - } else if (msg.GetType() == EArchMsgType::TimerTick){ + } else if (msg.GetType() == EArchMsgType::TimerTick) { auto ret = x14_savegameScreen->Update(MakeMsg::GetParmTimerTick(msg).x4_parm); if (ret != EMessageReturn::Exit) { return EMessageReturn::RemoveIOWinAndExit; diff --git a/Runtime/MP1/CCredits.cpp b/Runtime/MP1/CCredits.cpp index 3eb25e9e7..497118e5d 100644 --- a/Runtime/MP1/CCredits.cpp +++ b/Runtime/MP1/CCredits.cpp @@ -67,23 +67,23 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) { x30_text.back().first->SetText(x18_creditsTable->GetString(i)); } -// auto tmp = std::make_pair(std::make_unique( -// g_ResFactory->GetResourceIdByName(g_tweakGui->GetCreditsFont())->id, -// CGuiTextProperties(true, true, EJustification::Center, EVerticalJustification::Top), -// g_tweakGui->GetCreditsTextFontColor(), g_tweakGui->GetCreditsTextBorderColor(), -// zeus::skWhite, g_Viewport.x8_width - 64, 0, g_SimplePool, -// CGuiWidget::EGuiModelDrawFlags::Alpha), -// zeus::CVector2i(0, 0)); -// tmp.first->SetText( -// "\n&push;&font=C29C51F1;&main-color=#89D6FF;URDE DEVELOPMENT TEAM&pop;\n" -// "&push;&main-color=#89D6FF;LEAD REVERSE ENGINEERING TEAM&pop\n;" -// "Jack \"Cirrus\" Andersen\n" -// "Phillip \"Antidote\" Stephens\n" -// "Luke \"encounter\" Street\n\n" -// "&push;&main-color=#89D6FF;C++ COMPLIANCE & CLEANUP&pop;\n" -// "Lioncache\n"); -// x30_text.insert(x30_text.end() - 1, std::move(tmp)); -// x30_text.back().first->SetOutlineColor(g_tweakGui->GetCreditsTextBorderColor()); + // auto tmp = std::make_pair(std::make_unique( + // g_ResFactory->GetResourceIdByName(g_tweakGui->GetCreditsFont())->id, + // CGuiTextProperties(true, true, EJustification::Center, + // EVerticalJustification::Top), g_tweakGui->GetCreditsTextFontColor(), + // g_tweakGui->GetCreditsTextBorderColor(), zeus::skWhite, g_Viewport.x8_width + // - 64, 0, g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha), + // zeus::CVector2i(0, 0)); + // tmp.first->SetText( + // "\n&push;&font=C29C51F1;&main-color=#89D6FF;URDE DEVELOPMENT TEAM&pop;\n" + // "&push;&main-color=#89D6FF;LEAD REVERSE ENGINEERING TEAM&pop\n;" + // "Jack \"Cirrus\" Andersen\n" + // "Phillip \"Antidote\" Stephens\n" + // "Luke \"encounter\" Street\n\n" + // "&push;&main-color=#89D6FF;C++ COMPLIANCE & CLEANUP&pop;\n" + // "Lioncache\n"); + // x30_text.insert(x30_text.end() - 1, std::move(tmp)); + // x30_text.back().first->SetOutlineColor(g_tweakGui->GetCreditsTextBorderColor()); } for (const auto& [text, offset] : x30_text) { @@ -247,7 +247,7 @@ void CCredits::DrawText() { } void CCredits::DrawText(CGuiTextSupport& text, const zeus::CVector3f& translation) { - //auto region = g_Renderer->SetViewportOrtho(false, -4096, 4096); + // auto region = g_Renderer->SetViewportOrtho(false, -4096, 4096); zeus::CTransform xf = zeus::CTransform::Translate(translation); g_Renderer->SetModelMatrix(xf); text.Render(); diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index a103e7b66..a78598f65 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -1187,14 +1187,14 @@ void CFrontEndUI::SFrontEndFrame::FinishedLoading() { x14_loadedFrme->SetAspectConstraint(1.78f); x18_tablegroup_mainmenu = static_cast(x14_loadedFrme->FindWidget("tablegroup_mainmenu")); - //TODO: HACK: Implement language menu so this isn't necessary + // TODO: HACK: Implement language menu so this isn't necessary if (g_Main->IsUSA() && !g_Main->IsTrilogy()) { x1c_gbaPair = FindTextPanePair(x14_loadedFrme, "textpane_gba"); } else { x1c_gbaPair = FindTextPanePair(x14_loadedFrme, "textpane_lang"); } x1c_gbaPair.SetPairText(g_MainStringTable->GetString(37)); - //TODO: HACK: Implement language menu so this isn't necessary + // TODO: HACK: Implement language menu so this isn't necessary if (g_Main->IsUSA() && !g_Main->IsTrilogy()) { x24_cheatPair = FindTextPanePair(x14_loadedFrme, "textpane_cheats"); } else { @@ -1204,7 +1204,7 @@ void CFrontEndUI::SFrontEndFrame::FinishedLoading() { FindAndSetPairText(x14_loadedFrme, "textpane_start", g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 67 : 61)); - //TODO: HACK: Implement language menu so this isn't necessary + // TODO: HACK: Implement language menu so this isn't necessary FindAndSetPairText(x14_loadedFrme, (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? "textpane_options" : "textpane_gba", g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 94 : 88)); FindAndSetPairText(x14_loadedFrme, "textpane_title", diff --git a/Runtime/MP1/CFrontEndUITouchBarMac.mm b/Runtime/MP1/CFrontEndUITouchBarMac.mm index e07efdf55..4015dcbd9 100644 --- a/Runtime/MP1/CFrontEndUITouchBarMac.mm +++ b/Runtime/MP1/CFrontEndUITouchBarMac.mm @@ -1,7 +1,7 @@ -#include #include "CFrontEndUITouchBar.hpp" #include "GameGlobalObjects.hpp" #include "MP1/MP1.hpp" +#include #if !__has_feature(objc_arc) #error ARC Required @@ -10,787 +10,658 @@ extern "C" uint8_t START_BUTTON_2X[]; extern "C" size_t START_BUTTON_2X_SZ; -static NSColor* BlueConfirm() -{ - return [NSColor colorWithSRGBRed:0/255.f green:130/255.f blue:215/255.f alpha:1.f]; +static NSColor *BlueConfirm() { + return [NSColor colorWithSRGBRed:0 / 255.f green:130 / 255.f blue:215 / 255.f alpha:1.f]; } -static NSColor* NormalModeColor() -{ - return [NSColor colorWithSRGBRed:0/255.f green:130/255.f blue:0/255.f alpha:1.f]; +static NSColor *NormalModeColor() { + return [NSColor colorWithSRGBRed:0 / 255.f green:130 / 255.f blue:0 / 255.f alpha:1.f]; } -static NSColor* HardModeColor() -{ - return [NSColor redColor]; +static NSColor *HardModeColor() { return [NSColor redColor]; } + +static NSColor *FileColor(const metaforce::CFrontEndUITouchBar::SFileSelectDetail &detail) { + switch (detail.state) { + case metaforce::CFrontEndUITouchBar::EFileState::New: + return [NSColor darkGrayColor]; + case metaforce::CFrontEndUITouchBar::EFileState::Normal: + return NormalModeColor(); + case metaforce::CFrontEndUITouchBar::EFileState::Hard: + return HardModeColor(); + } } -static NSColor* FileColor(const metaforce::CFrontEndUITouchBar::SFileSelectDetail& detail) -{ - switch (detail.state) - { - case metaforce::CFrontEndUITouchBar::EFileState::New: - return [NSColor darkGrayColor]; - case metaforce::CFrontEndUITouchBar::EFileState::Normal: - return NormalModeColor(); - case metaforce::CFrontEndUITouchBar::EFileState::Hard: - return HardModeColor(); - } -} - -@interface FrontEndUITouchBarPressStart : NSObject -{ +@interface FrontEndUITouchBarPressStart : NSObject { @public - BOOL _startPressed; + BOOL _startPressed; } --(IBAction)onPressStart:(id)sender; +- (IBAction)onPressStart:(id)sender; @end @implementation FrontEndUITouchBarPressStart -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"pressStartGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"pressStartGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"pressStartGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"pressStartGroup"]; + id items = @[ @"pressStart" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"pressStartGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"pressStart"]) { + NSData *imgData = [NSData dataWithBytesNoCopy:START_BUTTON_2X length:START_BUTTON_2X_SZ freeWhenDone:NO]; + NSImage *img = [[NSImage alloc] initWithData:imgData]; + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Start" image:img target:self action:@selector(onPressStart:)]; + button.imageHugsTitle = YES; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"pressStartGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = @[@"pressStart"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"pressStart"]) - { - NSData* imgData = [NSData dataWithBytesNoCopy:START_BUTTON_2X length:START_BUTTON_2X_SZ freeWhenDone:NO]; - NSImage* img = [[NSImage alloc] initWithData:imgData]; - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Start" image:img target:self action:@selector(onPressStart:)]; - button.imageHugsTitle = YES; - item.view = button; - return item; - } - return nil; -} --(IBAction)onPressStart:(id)sender -{ - _startPressed = YES; +- (IBAction)onPressStart:(id)sender { + _startPressed = YES; } @end -@interface FrontEndUITouchBarProceedBack : NSObject -{ +@interface FrontEndUITouchBarProceedBack : NSObject { @public - metaforce::CFrontEndUITouchBar::EAction _action; + metaforce::CFrontEndUITouchBar::EAction _action; } --(IBAction)onBack:(id)sender; --(IBAction)onProceed:(id)sender; +- (IBAction)onBack:(id)sender; +- (IBAction)onProceed:(id)sender; @end @implementation FrontEndUITouchBarProceedBack -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"proceedBackGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"proceedBackGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"proceedBackGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"proceedBackGroup"]; + id items = @[ @"back", @"proceed" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"proceedBackGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"back"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] + target:self + action:@selector(onBack:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"proceed"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoForwardTemplate] + target:self + action:@selector(onProceed:)]; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"proceedBackGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = @[@"back", @"proceed"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"back"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] - target:self action:@selector(onBack:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"proceed"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoForwardTemplate] - target:self action:@selector(onProceed:)]; - item.view = button; - return item; - } - return nil; +- (IBAction)onBack:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Back; } --(IBAction)onBack:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Back; -} --(IBAction)onProceed:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Confirm; +- (IBAction)onProceed:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Confirm; } @end -@interface FrontEndUITouchBarStartOptions : NSObject -{ +@interface FrontEndUITouchBarStartOptions : NSObject { @public - metaforce::CFrontEndUITouchBar::EAction _action; - BOOL _normalBeat; + metaforce::CFrontEndUITouchBar::EAction _action; + BOOL _normalBeat; } --(IBAction)onStart:(id)sender; --(IBAction)onNormal:(id)sender; --(IBAction)onHard:(id)sender; --(IBAction)onOptions:(id)sender; --(IBAction)onCancel:(id)sender; +- (IBAction)onStart:(id)sender; +- (IBAction)onNormal:(id)sender; +- (IBAction)onHard:(id)sender; +- (IBAction)onOptions:(id)sender; +- (IBAction)onCancel:(id)sender; @end @implementation FrontEndUITouchBarStartOptions -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"startOptionsGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"startOptionsGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"startOptionsGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"startOptionsGroup"]; + id items = _normalBeat ? @[ @"cancel", @"normal", @"hard", @"options" ] : @[ @"cancel", @"start", @"options" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"startOptionsGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"start"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Start" target:self action:@selector(onStart:)]; + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"normal"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Normal Mode" target:self action:@selector(onNormal:)]; + button.bezelColor = NormalModeColor(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"hard"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Hard Mode" target:self action:@selector(onHard:)]; + button.bezelColor = HardModeColor(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"options"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Options" target:self action:@selector(onOptions:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"cancel"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] + target:self + action:@selector(onCancel:)]; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"startOptionsGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = _normalBeat ? @[@"cancel", @"normal", @"hard", @"options"] : - @[@"cancel", @"start", @"options"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"start"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Start" target:self action:@selector(onStart:)]; - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"normal"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Normal Mode" target:self action:@selector(onNormal:)]; - button.bezelColor = NormalModeColor(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"hard"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Hard Mode" target:self action:@selector(onHard:)]; - button.bezelColor = HardModeColor(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"options"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Options" target:self action:@selector(onOptions:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"cancel"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] - target:self action:@selector(onCancel:)]; - item.view = button; - return item; - } - return nil; +- (IBAction)onStart:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Start; } --(IBAction)onStart:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Start; +- (IBAction)onNormal:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Normal; } --(IBAction)onNormal:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Normal; +- (IBAction)onHard:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Hard; } --(IBAction)onHard:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Hard; +- (IBAction)onOptions:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Options; } --(IBAction)onOptions:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Options; -} --(IBAction)onCancel:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Back; +- (IBAction)onCancel:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Back; } @end -@interface FrontEndUITouchBarEraseBack : NSObject -{ +@interface FrontEndUITouchBarEraseBack : NSObject { @public - metaforce::CFrontEndUITouchBar::EAction _action; + metaforce::CFrontEndUITouchBar::EAction _action; } --(IBAction)onCancel:(id)sender; --(IBAction)onErase:(id)sender; +- (IBAction)onCancel:(id)sender; +- (IBAction)onErase:(id)sender; @end @implementation FrontEndUITouchBarEraseBack -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"eraseBackGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"eraseBackGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"eraseBackGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"eraseBackGroup"]; + id items = @[ @"cancel", @"erase" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"eraseBackGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"cancel"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Cancel" target:self action:@selector(onCancel:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"erase"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Erase" target:self action:@selector(onErase:)]; + button.bezelColor = [NSColor redColor]; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"eraseBackGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = @[@"cancel", @"erase"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"cancel"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Cancel" target:self action:@selector(onCancel:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"erase"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Erase" target:self action:@selector(onErase:)]; - button.bezelColor = [NSColor redColor]; - item.view = button; - return item; - } - return nil; +- (IBAction)onCancel:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Back; } --(IBAction)onCancel:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Back; -} --(IBAction)onErase:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Confirm; +- (IBAction)onErase:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Confirm; } @end -static NSString* GetFileSelectTitle(const metaforce::CFrontEndUITouchBar::SFileSelectDetail& detail, char letter) -{ - switch (detail.state) - { - case metaforce::CFrontEndUITouchBar::EFileState::New: - return [NSString stringWithFormat:@"[New Game %c]", letter]; - case metaforce::CFrontEndUITouchBar::EFileState::Normal: - return [NSString stringWithFormat:@"[Samus %c] %d%%", letter, detail.percent]; - case metaforce::CFrontEndUITouchBar::EFileState::Hard: - return [NSString stringWithFormat:@"[Hard %c] %d%%", letter, detail.percent]; - } - return @""; +static NSString *GetFileSelectTitle(const metaforce::CFrontEndUITouchBar::SFileSelectDetail &detail, char letter) { + switch (detail.state) { + case metaforce::CFrontEndUITouchBar::EFileState::New: + return [NSString stringWithFormat:@"[New Game %c]", letter]; + case metaforce::CFrontEndUITouchBar::EFileState::Normal: + return [NSString stringWithFormat:@"[Samus %c] %d%%", letter, detail.percent]; + case metaforce::CFrontEndUITouchBar::EFileState::Hard: + return [NSString stringWithFormat:@"[Hard %c] %d%%", letter, detail.percent]; + } + return @""; } -@interface FrontEndUITouchBarFileSelect : NSObject -{ +@interface FrontEndUITouchBarFileSelect : NSObject { @public - metaforce::CFrontEndUITouchBar::SFileSelectDetail _details[3]; - metaforce::CFrontEndUITouchBar::EAction _action; - BOOL _eraseGame; - BOOL _galleryActive; + metaforce::CFrontEndUITouchBar::SFileSelectDetail _details[3]; + metaforce::CFrontEndUITouchBar::EAction _action; + BOOL _eraseGame; + BOOL _galleryActive; } --(IBAction)onFileA:(id)sender; --(IBAction)onFileB:(id)sender; --(IBAction)onFileC:(id)sender; --(IBAction)onErase:(id)sender; --(IBAction)onFusionBonus:(id)sender; --(IBAction)onImageGallery:(id)sender; +- (IBAction)onFileA:(id)sender; +- (IBAction)onFileB:(id)sender; +- (IBAction)onFileC:(id)sender; +- (IBAction)onErase:(id)sender; +- (IBAction)onFusionBonus:(id)sender; +- (IBAction)onImageGallery:(id)sender; @end @implementation FrontEndUITouchBarFileSelect -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"fileSelectGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"fileSelectGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"fileSelectGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"fileSelectGroup"]; + id items = @[ @"fileA", @"fileB", @"fileC", @"erase", @"fusionBonus", @"imageGallery" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"fileSelectGroup"; - return touchBar; -} --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"fileSelectGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = @[@"fileA", @"fileB", @"fileC", @"erase", @"fusionBonus", @"imageGallery"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"fileA"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:GetFileSelectTitle(_details[0], 'A') target:self action:@selector(onFileA:)]; - button.bezelColor = FileColor(_details[0]); - button.enabled = !_eraseGame || _details[0].state != metaforce::CFrontEndUITouchBar::EFileState::New; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"fileB"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:GetFileSelectTitle(_details[1], 'B') target:self action:@selector(onFileB:)]; - button.bezelColor = FileColor(_details[1]); - button.enabled = !_eraseGame || _details[1].state != metaforce::CFrontEndUITouchBar::EFileState::New; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"fileC"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:GetFileSelectTitle(_details[2], 'C') target:self action:@selector(onFileC:)]; - button.bezelColor = FileColor(_details[2]); - button.enabled = !_eraseGame || _details[2].state != metaforce::CFrontEndUITouchBar::EFileState::New; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"erase"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - if (!_eraseGame) - { - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarDeleteTemplate] - target:self action:@selector(onErase:)]; - bool hasSave = false; - for (int i=0 ; i<3 ; ++i) - if (_details[i].state != metaforce::CFrontEndUITouchBar::EFileState::New) - { - hasSave = true; - break; - } - button.enabled = hasSave; - item.view = button; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"fileA"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:GetFileSelectTitle(_details[0], 'A') + target:self + action:@selector(onFileA:)]; + button.bezelColor = FileColor(_details[0]); + button.enabled = !_eraseGame || _details[0].state != metaforce::CFrontEndUITouchBar::EFileState::New; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"fileB"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:GetFileSelectTitle(_details[1], 'B') + target:self + action:@selector(onFileB:)]; + button.bezelColor = FileColor(_details[1]); + button.enabled = !_eraseGame || _details[1].state != metaforce::CFrontEndUITouchBar::EFileState::New; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"fileC"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:GetFileSelectTitle(_details[2], 'C') + target:self + action:@selector(onFileC:)]; + button.bezelColor = FileColor(_details[2]); + button.enabled = !_eraseGame || _details[2].state != metaforce::CFrontEndUITouchBar::EFileState::New; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"erase"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + if (!_eraseGame) { + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarDeleteTemplate] + target:self + action:@selector(onErase:)]; + bool hasSave = false; + for (int i = 0; i < 3; ++i) + if (_details[i].state != metaforce::CFrontEndUITouchBar::EFileState::New) { + hasSave = true; + break; } - else - { - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] - target:self action:@selector(onErase:)]; - item.view = button; - } - return item; + button.enabled = hasSave; + item.view = button; + } else { + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] + target:self + action:@selector(onErase:)]; + item.view = button; } - else if ([identifier isEqualToString:@"fusionBonus"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Bonuses" target:self action:@selector(onFusionBonus:)]; - button.enabled = !_eraseGame; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"imageGallery"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Gallery" target:self action:@selector(onImageGallery:)]; - button.enabled = !_eraseGame && _galleryActive; - item.view = button; - return item; - } - return nil; + return item; + } else if ([identifier isEqualToString:@"fusionBonus"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Bonuses" target:self action:@selector(onFusionBonus:)]; + button.enabled = !_eraseGame; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"imageGallery"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Gallery" target:self action:@selector(onImageGallery:)]; + button.enabled = !_eraseGame && _galleryActive; + item.view = button; + return item; + } + return nil; } --(IBAction)onFileA:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::FileA; +- (IBAction)onFileA:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::FileA; } --(IBAction)onFileB:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::FileB; +- (IBAction)onFileB:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::FileB; } --(IBAction)onFileC:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::FileC; +- (IBAction)onFileC:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::FileC; } --(IBAction)onErase:(id)sender -{ - if (!_eraseGame) - _action = metaforce::CFrontEndUITouchBar::EAction::Erase; - else - _action = metaforce::CFrontEndUITouchBar::EAction::Back; +- (IBAction)onErase:(id)sender { + if (!_eraseGame) + _action = metaforce::CFrontEndUITouchBar::EAction::Erase; + else + _action = metaforce::CFrontEndUITouchBar::EAction::Back; } --(IBAction)onFusionBonus:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::FusionBonus; +- (IBAction)onFusionBonus:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::FusionBonus; } --(IBAction)onImageGallery:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::ImageGallery; +- (IBAction)onImageGallery:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::ImageGallery; } @end -@interface FrontEndUITouchBarNoCardSelect : NSObject -{ +@interface FrontEndUITouchBarNoCardSelect : NSObject { @public - metaforce::CFrontEndUITouchBar::EAction _action; - BOOL _galleryActive; + metaforce::CFrontEndUITouchBar::EAction _action; + BOOL _galleryActive; } --(IBAction)onStart:(id)sender; --(IBAction)onOptions:(id)sender; --(IBAction)onFusionBonus:(id)sender; --(IBAction)onImageGallery:(id)sender; +- (IBAction)onStart:(id)sender; +- (IBAction)onOptions:(id)sender; +- (IBAction)onFusionBonus:(id)sender; +- (IBAction)onImageGallery:(id)sender; @end @implementation FrontEndUITouchBarNoCardSelect -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"noCardSelectGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"noCardSelectGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"noCardSelectGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"noCardSelectGroup"]; + id items = @[ @"start", @"fusionBonus", @"options", @"imageGallery" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"noCardSelectGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"start"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Start" target:self action:@selector(onStart:)]; + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"options"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Options" target:self action:@selector(onOptions:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"fusionBonus"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Fusion Bonuses" target:self action:@selector(onFusionBonus:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"imageGallery"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Image Gallery" target:self action:@selector(onImageGallery:)]; + button.enabled = _galleryActive; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"noCardSelectGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = @[@"start", @"fusionBonus", @"options", @"imageGallery"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"start"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Start" target:self action:@selector(onStart:)]; - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"options"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Options" target:self action:@selector(onOptions:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"fusionBonus"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Fusion Bonuses" target:self action:@selector(onFusionBonus:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"imageGallery"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Image Gallery" target:self action:@selector(onImageGallery:)]; - button.enabled = _galleryActive; - item.view = button; - return item; - } - return nil; +- (IBAction)onStart:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Start; } --(IBAction)onStart:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Start; +- (IBAction)onOptions:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Options; } --(IBAction)onOptions:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Options; +- (IBAction)onFusionBonus:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::FusionBonus; } --(IBAction)onFusionBonus:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::FusionBonus; -} --(IBAction)onImageGallery:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::ImageGallery; +- (IBAction)onImageGallery:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::ImageGallery; } @end -@interface FrontEndUITouchBarFusionBonus : NSObject -{ +@interface FrontEndUITouchBarFusionBonus : NSObject { @public - metaforce::CFrontEndUITouchBar::EAction _action; - BOOL _fusionSuitActive; + metaforce::CFrontEndUITouchBar::EAction _action; + BOOL _fusionSuitActive; } --(IBAction)onNESMetroid:(id)sender; --(IBAction)onFusionSuit:(id)sender; --(IBAction)onBack:(id)sender; +- (IBAction)onNESMetroid:(id)sender; +- (IBAction)onFusionSuit:(id)sender; +- (IBAction)onBack:(id)sender; @end @implementation FrontEndUITouchBarFusionBonus -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"fusionBonusGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"fusionBonusGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"fusionBonusGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"fusionBonusGroup"]; + id items = @[ @"back", @"NESMetroid", @"fusionSuit" ]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"fusionBonusGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"NESMetroid"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Play NES Metroid" target:self action:@selector(onNESMetroid:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"fusionSuit"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:@"Fusion Suit" target:self action:@selector(onFusionSuit:)]; + if (_fusionSuitActive) + button.bezelColor = BlueConfirm(); + item.view = button; + return item; + } else if ([identifier isEqualToString:@"back"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] + target:self + action:@selector(onBack:)]; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"fusionBonusGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items = @[@"back", @"NESMetroid", @"fusionSuit"]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"NESMetroid"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Play NES Metroid" target:self action:@selector(onNESMetroid:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"fusionSuit"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:@"Fusion Suit" target:self action:@selector(onFusionSuit:)]; - if (_fusionSuitActive) - button.bezelColor = BlueConfirm(); - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"back"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarGoBackTemplate] - target:self action:@selector(onBack:)]; - item.view = button; - return item; - } - return nil; +- (IBAction)onNESMetroid:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::NESMetroid; } --(IBAction)onNESMetroid:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::NESMetroid; +- (IBAction)onFusionSuit:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::FusionSuit; } --(IBAction)onFusionSuit:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::FusionSuit; -} --(IBAction)onBack:(id)sender -{ - _action = metaforce::CFrontEndUITouchBar::EAction::Back; +- (IBAction)onBack:(id)sender { + _action = metaforce::CFrontEndUITouchBar::EAction::Back; } @end -namespace metaforce -{ +namespace metaforce { -class CFrontEndUITouchBarMac : public CFrontEndUITouchBar -{ - FrontEndUITouchBarPressStart* m_pressStartBar; - FrontEndUITouchBarProceedBack* m_proceedBackBar; - FrontEndUITouchBarStartOptions* m_startOptions; - FrontEndUITouchBarEraseBack* m_eraseBack; - FrontEndUITouchBarFileSelect* m_fileSelectBar; - FrontEndUITouchBarNoCardSelect* m_noCardSelectBar; - FrontEndUITouchBarFusionBonus* m_fusionBonusBar; +class CFrontEndUITouchBarMac : public CFrontEndUITouchBar { + FrontEndUITouchBarPressStart *m_pressStartBar; + FrontEndUITouchBarProceedBack *m_proceedBackBar; + FrontEndUITouchBarStartOptions *m_startOptions; + FrontEndUITouchBarEraseBack *m_eraseBack; + FrontEndUITouchBarFileSelect *m_fileSelectBar; + FrontEndUITouchBarNoCardSelect *m_noCardSelectBar; + FrontEndUITouchBarFusionBonus *m_fusionBonusBar; - void Activate() - { - id provider = nil; - switch (m_phase) - { - case EPhase::PressStart: - provider = m_pressStartBar; - break; - case EPhase::ProceedBack: - provider = m_proceedBackBar; - break; - case EPhase::StartOptions: - provider = m_startOptions; - break; - case EPhase::EraseBack: - provider = m_eraseBack; - break; - case EPhase::FileSelect: - provider = m_fileSelectBar; - break; - case EPhase::NoCardSelect: - provider = m_noCardSelectBar; - break; - case EPhase::FusionBonus: - provider = m_fusionBonusBar; - break; - default: break; - } - g_Main->GetMainWindow()->setTouchBarProvider((__bridge_retained void*)provider); + void Activate() { + id provider = nil; + switch (m_phase) { + case EPhase::PressStart: + provider = m_pressStartBar; + break; + case EPhase::ProceedBack: + provider = m_proceedBackBar; + break; + case EPhase::StartOptions: + provider = m_startOptions; + break; + case EPhase::EraseBack: + provider = m_eraseBack; + break; + case EPhase::FileSelect: + provider = m_fileSelectBar; + break; + case EPhase::NoCardSelect: + provider = m_noCardSelectBar; + break; + case EPhase::FusionBonus: + provider = m_fusionBonusBar; + break; + default: + break; } + g_Main->GetMainWindow()->setTouchBarProvider((__bridge_retained void *)provider); + } public: - CFrontEndUITouchBarMac() - { - m_pressStartBar = [FrontEndUITouchBarPressStart new]; - m_proceedBackBar = [FrontEndUITouchBarProceedBack new]; - m_startOptions = [FrontEndUITouchBarStartOptions new]; - m_eraseBack = [FrontEndUITouchBarEraseBack new]; - m_fileSelectBar = [FrontEndUITouchBarFileSelect new]; - m_noCardSelectBar = [FrontEndUITouchBarNoCardSelect new]; - m_fusionBonusBar = [FrontEndUITouchBarFusionBonus new]; - } - void SetPhase(EPhase ph) - { - m_phase = ph; - Activate(); - } - EPhase GetPhase() - { - return m_phase; - } - void SetFileSelectPhase(const SFileSelectDetail details[3], bool eraseGame, bool galleryActive) - { - m_fileSelectBar->_details[0] = details[0]; - m_fileSelectBar->_details[1] = details[1]; - m_fileSelectBar->_details[2] = details[2]; - m_fileSelectBar->_eraseGame = eraseGame; - m_fileSelectBar->_galleryActive = galleryActive; - m_phase = EPhase::FileSelect; - Activate(); - } - void SetNoCardSelectPhase(bool galleryActive) - { - m_noCardSelectBar->_galleryActive = galleryActive; - m_phase = EPhase::NoCardSelect; - Activate(); - } - void SetFusionBonusPhase(bool fusionSuitActive) - { - m_fusionBonusBar->_fusionSuitActive = fusionSuitActive; - m_phase = EPhase::FusionBonus; - Activate(); - } - void SetStartOptionsPhase(bool normalBeat) - { - m_startOptions->_normalBeat = normalBeat; - m_phase = EPhase::StartOptions; - Activate(); - } - EAction PopAction() - { - switch (m_phase) - { - case EPhase::PressStart: - if (m_pressStartBar->_startPressed) - { - m_pressStartBar->_startPressed = NO; - return EAction::Start; - } - break; - case EPhase::ProceedBack: - if (m_proceedBackBar->_action != EAction::None) - { - EAction action = m_proceedBackBar->_action; - m_proceedBackBar->_action = EAction::None; - return action; - } - break; - case EPhase::StartOptions: - if (m_startOptions->_action != EAction::None) - { - EAction action = m_startOptions->_action; - m_startOptions->_action = EAction::None; - return action; - } - break; - case EPhase::EraseBack: - if (m_eraseBack->_action != EAction::None) - { - EAction action = m_eraseBack->_action; - m_eraseBack->_action = EAction::None; - return action; - } - break; - case EPhase::FileSelect: - if (m_fileSelectBar->_action != EAction::None) - { - EAction action = m_fileSelectBar->_action; - m_fileSelectBar->_action = EAction::None; - return action; - } - break; - case EPhase::NoCardSelect: - if (m_noCardSelectBar->_action != EAction::None) - { - EAction action = m_noCardSelectBar->_action; - m_noCardSelectBar->_action = EAction::None; - return action; - } - break; - case EPhase::FusionBonus: - if (m_fusionBonusBar->_action != EAction::None) - { - EAction action = m_fusionBonusBar->_action; - m_fusionBonusBar->_action = EAction::None; - return action; - } - break; - default: break; - } - return EAction::None; + CFrontEndUITouchBarMac() { + m_pressStartBar = [FrontEndUITouchBarPressStart new]; + m_proceedBackBar = [FrontEndUITouchBarProceedBack new]; + m_startOptions = [FrontEndUITouchBarStartOptions new]; + m_eraseBack = [FrontEndUITouchBarEraseBack new]; + m_fileSelectBar = [FrontEndUITouchBarFileSelect new]; + m_noCardSelectBar = [FrontEndUITouchBarNoCardSelect new]; + m_fusionBonusBar = [FrontEndUITouchBarFusionBonus new]; + } + void SetPhase(EPhase ph) { + m_phase = ph; + Activate(); + } + EPhase GetPhase() { return m_phase; } + void SetFileSelectPhase(const SFileSelectDetail details[3], bool eraseGame, bool galleryActive) { + m_fileSelectBar->_details[0] = details[0]; + m_fileSelectBar->_details[1] = details[1]; + m_fileSelectBar->_details[2] = details[2]; + m_fileSelectBar->_eraseGame = eraseGame; + m_fileSelectBar->_galleryActive = galleryActive; + m_phase = EPhase::FileSelect; + Activate(); + } + void SetNoCardSelectPhase(bool galleryActive) { + m_noCardSelectBar->_galleryActive = galleryActive; + m_phase = EPhase::NoCardSelect; + Activate(); + } + void SetFusionBonusPhase(bool fusionSuitActive) { + m_fusionBonusBar->_fusionSuitActive = fusionSuitActive; + m_phase = EPhase::FusionBonus; + Activate(); + } + void SetStartOptionsPhase(bool normalBeat) { + m_startOptions->_normalBeat = normalBeat; + m_phase = EPhase::StartOptions; + Activate(); + } + EAction PopAction() { + switch (m_phase) { + case EPhase::PressStart: + if (m_pressStartBar->_startPressed) { + m_pressStartBar->_startPressed = NO; + return EAction::Start; + } + break; + case EPhase::ProceedBack: + if (m_proceedBackBar->_action != EAction::None) { + EAction action = m_proceedBackBar->_action; + m_proceedBackBar->_action = EAction::None; + return action; + } + break; + case EPhase::StartOptions: + if (m_startOptions->_action != EAction::None) { + EAction action = m_startOptions->_action; + m_startOptions->_action = EAction::None; + return action; + } + break; + case EPhase::EraseBack: + if (m_eraseBack->_action != EAction::None) { + EAction action = m_eraseBack->_action; + m_eraseBack->_action = EAction::None; + return action; + } + break; + case EPhase::FileSelect: + if (m_fileSelectBar->_action != EAction::None) { + EAction action = m_fileSelectBar->_action; + m_fileSelectBar->_action = EAction::None; + return action; + } + break; + case EPhase::NoCardSelect: + if (m_noCardSelectBar->_action != EAction::None) { + EAction action = m_noCardSelectBar->_action; + m_noCardSelectBar->_action = EAction::None; + return action; + } + break; + case EPhase::FusionBonus: + if (m_fusionBonusBar->_action != EAction::None) { + EAction action = m_fusionBonusBar->_action; + m_fusionBonusBar->_action = EAction::None; + return action; + } + break; + default: + break; } + return EAction::None; + } }; -std::unique_ptr NewFrontEndUITouchBar() -{ - return std::make_unique(); -} +std::unique_ptr NewFrontEndUITouchBar() { return std::make_unique(); } } diff --git a/Runtime/MP1/CGameCubeDoll.cpp b/Runtime/MP1/CGameCubeDoll.cpp index e8ac9f944..6c872616c 100644 --- a/Runtime/MP1/CGameCubeDoll.cpp +++ b/Runtime/MP1/CGameCubeDoll.cpp @@ -13,9 +13,8 @@ CGameCubeDoll::CGameCubeDoll() { } void CGameCubeDoll::UpdateActorLights() { - x8_lights[0] = CLight::BuildDirectional( - (zeus::skForward + zeus::skRight * 0.25f + zeus::skDown * 0.1f).normalized(), - zeus::skWhite); + x8_lights[0] = CLight::BuildDirectional((zeus::skForward + zeus::skRight * 0.25f + zeus::skDown * 0.1f).normalized(), + zeus::skWhite); x18_actorLights->BuildFakeLightList(x8_lights, zeus::CColor(0.25f, 1.f)); } diff --git a/Runtime/MP1/CInventoryScreen.cpp b/Runtime/MP1/CInventoryScreen.cpp index e43dbb5ca..8765a1833 100644 --- a/Runtime/MP1/CInventoryScreen.cpp +++ b/Runtime/MP1/CInventoryScreen.cpp @@ -125,8 +125,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) { return; float absViewInterp = std::fabs(viewInterp); - if ((input.PY() || ((m_bodyUpClicked || m_bodyClicked) && absViewInterp == 0.f)) && - x19c_samusDoll->IsLoaded() && (absViewInterp > 0.f || x10_mode != EMode::TextScroll)) { + if ((input.PY() || ((m_bodyUpClicked || m_bodyClicked) && absViewInterp == 0.f)) && x19c_samusDoll->IsLoaded() && + (absViewInterp > 0.f || x10_mode != EMode::TextScroll)) { x19c_samusDoll->BeginViewInterpolate(absViewInterp == 0.f); if (absViewInterp == 0.f) { if (const auto& kbm = input.GetKBM()) { @@ -232,8 +232,9 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) { x198_28_pulseTextArrowTop = false; } if (!x1ac_textLeaveRequested) - x1ac_textLeaveRequested = input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) || - ((input.PA() || m_bodyClicked || input.PSpecialKey(boo::ESpecialKey::Enter)) && lastPage); + x1ac_textLeaveRequested = + input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) || + ((input.PA() || m_bodyClicked || input.PSpecialKey(boo::ESpecialKey::Enter)) && lastPage); x1ad_textViewing = !x1ac_textLeaveRequested; } else { x198_29_pulseTextArrowBottom = false; @@ -311,7 +312,8 @@ void CInventoryScreen::UpdateTextBody() { x1ac_textLeaveRequested = false; const SInventoryItem& sel = InventoryRegistry[x70_tablegroup_leftlog->GetUserSelection()].second[x1c_rightSel]; - std::u16string entryText = xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? sel.entryStrIdx : sel.entryStrIdx + 3); + std::u16string entryText = + xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? sel.entryStrIdx : sel.entryStrIdx + 3); if (sel.idx == 23) // Beam combo { @@ -467,7 +469,8 @@ void CInventoryScreen::UpdateRightTable() { CGuiTextPane* title = xd8_textpane_titles[i]; if (i < int(size)) { if (HasRightInventoryItem(data[i].idx)) { - title->TextSupport().SetText(xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? data[i].nameStrIdx : data[i].nameStrIdx + 3)); + title->TextSupport().SetText(xc_pauseStrg.GetString( + (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? data[i].nameStrIdx : data[i].nameStrIdx + 3)); x84_tablegroup_rightlog->GetWorkerWidget(i + 1)->SetIsSelectable(true); if (i < minSel) minSel = i; diff --git a/Runtime/MP1/CLogBookScreen.cpp b/Runtime/MP1/CLogBookScreen.cpp index 35f4f9ba9..88c2b63aa 100644 --- a/Runtime/MP1/CLogBookScreen.cpp +++ b/Runtime/MP1/CLogBookScreen.cpp @@ -73,7 +73,8 @@ void CLogBookScreen::InitializeLogBook() { } void CLogBookScreen::UpdateRightTitles() { - const std::vector>& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()]; + const std::vector>& category = + x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()]; for (size_t i = 0; i < xd8_textpane_titles.size(); ++i) { std::u16string string; const auto scanIndex = size_t(x18_firstViewRightSel) + i; @@ -337,7 +338,7 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) { if (input.PLAUp() || m_bodyUpClicked) newPage = std::max(oldPage - 1, 0); else if (input.PLADown() || m_bodyDownClicked || - ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage)) + ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage)) newPage = std::min(oldPage + 1, pageCount - 1); x174_textpane_body->TextSupport().SetPage(newPage); if (oldPage != newPage) @@ -350,8 +351,9 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) { } if (!x260_26_exitTextScroll) - x260_26_exitTextScroll = input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) || - ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && lastPage); + x260_26_exitTextScroll = + input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) || + ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && lastPage); if (g_tweakGui->GetLatchArticleText()) x260_25_inTextScroll = !x260_26_exitTextScroll; diff --git a/Runtime/MP1/CLogBookScreen.hpp b/Runtime/MP1/CLogBookScreen.hpp index e6d7ee8d7..cc4a06aec 100644 --- a/Runtime/MP1/CLogBookScreen.hpp +++ b/Runtime/MP1/CLogBookScreen.hpp @@ -43,7 +43,8 @@ class CLogBookScreen : public CPauseScreenBase { int NextSurroundingArticleIndex(int cur) const; bool IsArtifactCategorySelected() const; int GetSelectedArtifactHeadScanIndex() const; - static bool IsScanComplete(CWorldSaveGameInfo::EScanCategory category, CAssetId scan, const CPlayerState& playerState); + static bool IsScanComplete(CWorldSaveGameInfo::EScanCategory category, CAssetId scan, + const CPlayerState& playerState); public: CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg); diff --git a/Runtime/MP1/CMFGame.cpp b/Runtime/MP1/CMFGame.cpp index e966ca60e..2d73d2ada 100644 --- a/Runtime/MP1/CMFGame.cpp +++ b/Runtime/MP1/CMFGame.cpp @@ -16,9 +16,7 @@ namespace metaforce::MP1 { CMFGame::CMFGame(const std::weak_ptr& stateMgr, const std::weak_ptr& guiMgr, const CArchitectureQueue&) -: CMFGameBase("CMFGame") -, x14_stateManager(stateMgr.lock()) -, x18_guiManager(guiMgr.lock()) { +: CMFGameBase("CMFGame"), x14_stateManager(stateMgr.lock()), x18_guiManager(guiMgr.lock()) { static_cast(*g_Main).SetMFGameBuilt(true); } @@ -275,8 +273,7 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") { break; } - if (g_GameState->CurrentWorldAssetId() == 0x158EFE17 && - g_GameState->CurrentWorldState().GetCurrentAreaId() == 0) { + if (g_GameState->CurrentWorldAssetId() == 0x158EFE17 && g_GameState->CurrentWorldState().GetCurrentAreaId() == 0) { const SObjectTag* strgTag = g_ResFactory->GetResourceIdByName("STRG_IntroLevelLoad"); if (strgTag) g_GameState->GetWorldTransitionManager()->EnableTransition(-1, strgTag->id, 0, false, 0.1f, 16.f, 1.f); diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index 86e125e47..b8a546dfd 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -1,48 +1,48 @@ add_subdirectory(World) -if(APPLE) - set(MP1_PLAT_SOURCES - CFrontEndUITouchBarMac.mm - CSaveGameScreenTouchBarMac.mm) -endif() +if (APPLE) + set(MP1_PLAT_SOURCES + CFrontEndUITouchBarMac.mm + CSaveGameScreenTouchBarMac.mm) +endif () set(MP1_SOURCES - CTweaks.hpp CTweaks.cpp - CInGameTweakManager.hpp - CGBASupport.hpp CGBASupport.cpp - CMainFlow.hpp CMainFlow.cpp - CMFGame.hpp CMFGame.cpp - CPlayMovie.hpp CPlayMovie.cpp - CFrontEndUI.hpp CFrontEndUI.cpp - CFrontEndUITouchBar.hpp CFrontEndUITouchBar.cpp - CPreFrontEnd.hpp CPreFrontEnd.cpp - CSlideShow.hpp CSlideShow.cpp - CSaveGameScreen.hpp CSaveGameScreen.cpp - CSaveGameScreenTouchBar.hpp CSaveGameScreenTouchBar.cpp - CMemoryCardDriver.hpp CMemoryCardDriver.cpp - CQuitGameScreen.hpp CQuitGameScreen.cpp - CMessageScreen.hpp CMessageScreen.cpp - CCredits.hpp CCredits.cpp - CStateSetterFlow.hpp CStateSetterFlow.cpp - CAudioStateWin.hpp CAudioStateWin.cpp - CInGameGuiManager.hpp CInGameGuiManager.cpp - CInGameGuiManagerCommon.hpp - CSamusFaceReflection.hpp CSamusFaceReflection.cpp - CPlayerVisor.hpp CPlayerVisor.cpp - CSamusHud.hpp CSamusHud.cpp - CPauseScreenBlur.hpp CPauseScreenBlur.cpp - CPauseScreen.hpp CPauseScreen.cpp - CPauseScreenBase.hpp CPauseScreenBase.cpp - CFaceplateDecoration.hpp CFaceplateDecoration.cpp - CInventoryScreen.hpp CInventoryScreen.cpp - CLogBookScreen.hpp CLogBookScreen.cpp - COptionsScreen.hpp COptionsScreen.cpp - CSamusDoll.hpp CSamusDoll.cpp - CGameCubeDoll.hpp CGameCubeDoll.cpp - CArtifactDoll.hpp CArtifactDoll.cpp - CAutoSave.hpp CAutoSave.cpp - MP1.hpp MP1.cpp - ${MP1_PLAT_SOURCES} - ${MP1_WORLD_SOURCES}) + CTweaks.hpp CTweaks.cpp + CInGameTweakManager.hpp + CGBASupport.hpp CGBASupport.cpp + CMainFlow.hpp CMainFlow.cpp + CMFGame.hpp CMFGame.cpp + CPlayMovie.hpp CPlayMovie.cpp + CFrontEndUI.hpp CFrontEndUI.cpp + CFrontEndUITouchBar.hpp CFrontEndUITouchBar.cpp + CPreFrontEnd.hpp CPreFrontEnd.cpp + CSlideShow.hpp CSlideShow.cpp + CSaveGameScreen.hpp CSaveGameScreen.cpp + CSaveGameScreenTouchBar.hpp CSaveGameScreenTouchBar.cpp + CMemoryCardDriver.hpp CMemoryCardDriver.cpp + CQuitGameScreen.hpp CQuitGameScreen.cpp + CMessageScreen.hpp CMessageScreen.cpp + CCredits.hpp CCredits.cpp + CStateSetterFlow.hpp CStateSetterFlow.cpp + CAudioStateWin.hpp CAudioStateWin.cpp + CInGameGuiManager.hpp CInGameGuiManager.cpp + CInGameGuiManagerCommon.hpp + CSamusFaceReflection.hpp CSamusFaceReflection.cpp + CPlayerVisor.hpp CPlayerVisor.cpp + CSamusHud.hpp CSamusHud.cpp + CPauseScreenBlur.hpp CPauseScreenBlur.cpp + CPauseScreen.hpp CPauseScreen.cpp + CPauseScreenBase.hpp CPauseScreenBase.cpp + CFaceplateDecoration.hpp CFaceplateDecoration.cpp + CInventoryScreen.hpp CInventoryScreen.cpp + CLogBookScreen.hpp CLogBookScreen.cpp + COptionsScreen.hpp COptionsScreen.cpp + CSamusDoll.hpp CSamusDoll.cpp + CGameCubeDoll.hpp CGameCubeDoll.cpp + CArtifactDoll.hpp CArtifactDoll.cpp + CAutoSave.hpp CAutoSave.cpp + MP1.hpp MP1.cpp + ${MP1_PLAT_SOURCES} + ${MP1_WORLD_SOURCES}) runtime_add_list(MP1 MP1_SOURCES) diff --git a/Runtime/MP1/CMemoryCardDriver.cpp b/Runtime/MP1/CMemoryCardDriver.cpp index d132609b8..eee2a05ea 100644 --- a/Runtime/MP1/CMemoryCardDriver.cpp +++ b/Runtime/MP1/CMemoryCardDriver.cpp @@ -671,9 +671,8 @@ void CMemoryCardDriver::InitializeFileInfo() { ExportPersistentOptions(); OSCalendarTime time = CBasics::ToCalendarTime(std::chrono::system_clock::now()); - std::string timeString = fmt::format(FMT_STRING("{:02d}.{:02d}.{:02d} {:02d}:{:02d}"), - time.x10_mon + 1, time.xc_mday, time.x14_year % 100, - time.x8_hour, time.x4_min); + std::string timeString = fmt::format(FMT_STRING("{:02d}.{:02d}.{:02d} {:02d}:{:02d}"), time.x10_mon + 1, + time.xc_mday, time.x14_year % 100, time.x8_hour, time.x4_min); std::string comment("Metroid Prime "); comment += timeString; x198_fileInfo->SetComment(comment); diff --git a/Runtime/MP1/CMessageScreen.cpp b/Runtime/MP1/CMessageScreen.cpp index 29264d32c..2a63a3002 100644 --- a/Runtime/MP1/CMessageScreen.cpp +++ b/Runtime/MP1/CMessageScreen.cpp @@ -17,9 +17,8 @@ CMessageScreen::CMessageScreen(CAssetId msg, float delayTime) : x74_delayTime(de } void CMessageScreen::ProcessControllerInput(const CFinalInput& input) { - if (!x18_loadedMsgScreen || x74_delayTime > 0.f || !(input.PA() || - input.PSpecialKey(boo::ESpecialKey::Enter) || - input.PMouseButton(boo::EMouseButton::Primary))) + if (!x18_loadedMsgScreen || x74_delayTime > 0.f || + !(input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || input.PMouseButton(boo::EMouseButton::Primary))) return; if (x1c_textpane_message->TextSupport().GetCurTime() < x1c_textpane_message->TextSupport().GetTotalAnimationTime()) { diff --git a/Runtime/MP1/CPauseScreen.cpp b/Runtime/MP1/CPauseScreen.cpp index 7be8de7c9..44ced8985 100644 --- a/Runtime/MP1/CPauseScreen.cpp +++ b/Runtime/MP1/CPauseScreen.cpp @@ -202,8 +202,7 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal if (InputEnabled()) { bool invalid = x8_curSubscreen == ESubScreen::ToGame; - if (useInput.PStart() || - ((useInput.PB() || useInput.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) || + if (useInput.PStart() || ((useInput.PB() || useInput.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) || (x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) { CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); StartTransition(0.5f, mgr, ESubScreen::ToGame, 2); @@ -218,18 +217,22 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal } } - x38_textpane_l1->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x74_lTrigger[ - ControlMapper::GetDigitalInput(ControlMapper::ECommands::PreviousPauseScreen, useInput) || m_lDown])); - x3c_textpane_r->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x80_rTrigger[ - ControlMapper::GetDigitalInput(ControlMapper::ECommands::NextPauseScreen, useInput) || m_rDown])); + x38_textpane_l1->TextSupport().SetText(fmt::format( + FMT_STRING("&image={};"), + g_tweakPlayerRes + ->x74_lTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::PreviousPauseScreen, useInput) || + m_lDown])); + x3c_textpane_r->TextSupport().SetText(fmt::format( + FMT_STRING("&image={};"), + g_tweakPlayerRes + ->x80_rTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::NextPauseScreen, useInput) || + m_rDown])); x48_textpane_return->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown])); + fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown])); x50_textpane_back->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown])); + fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown])); x4c_textpane_next->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown])); + fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown])); } void CPauseScreen::TransitionComplete() { diff --git a/Runtime/MP1/CPauseScreenBase.cpp b/Runtime/MP1/CPauseScreenBase.cpp index 02b349a4b..e95565320 100644 --- a/Runtime/MP1/CPauseScreenBase.cpp +++ b/Runtime/MP1/CPauseScreenBase.cpp @@ -66,7 +66,8 @@ void CPauseScreenBase::InitializeFrameGlue() { x184_textpane_yicon = static_cast(x8_frame.FindWidget("textpane_yicon")); x188_textpane_ytext = static_cast(x8_frame.FindWidget("textpane_ytext")); x184_textpane_yicon->TextSupport().SetText(fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->xbc_yButton[0])); - x188_textpane_ytext->TextSupport().SetText(xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 99 : 102)); + x188_textpane_ytext->TextSupport().SetText( + xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 99 : 102)); x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor()); x18c_slidergroup_slider = static_cast(x8_frame.FindWidget("slidergroup_slider")); x18c_slidergroup_slider->SetMouseActive(true); @@ -93,16 +94,18 @@ void CPauseScreenBase::InitializeFrameGlue() { xd8_textpane_titles.push_back( static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_title{}"), i + 1)))); xd8_textpane_titles.back()->TextSupport().SetText(u""); - x144_model_titles.push_back(static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_title{}"), i + 1)))); + x144_model_titles.push_back( + static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_title{}"), i + 1)))); m_model_lefttitledecos.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_lefttitledeco{}"), i)))); + static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_lefttitledeco{}"), i)))); m_model_lefttitledecos.back()->SetMouseActive(true); x15c_model_righttitledecos.push_back( static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_righttitledeco{}"), i + 1)))); x15c_model_righttitledecos.back()->SetMouseActive(true); xa8_textpane_categories.push_back( static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_category{}"), i)))); - xc0_model_categories.push_back(static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_category{}"), i)))); + xc0_model_categories.push_back( + static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_category{}"), i)))); } for (int i = 0; i < 20; ++i) @@ -432,7 +435,8 @@ void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) { if (m_isLogBook && x10_mode == EMode::TextScroll) return; int idx = int(std::find(x15c_model_righttitledecos.begin(), x15c_model_righttitledecos.end(), widget) - - x15c_model_righttitledecos.begin()) + 1; + x15c_model_righttitledecos.begin()) + + 1; if (x10_mode == EMode::LeftTable) { if (ShouldLeftTableAdvance()) ChangeMode(EMode::RightTable, false); @@ -498,22 +502,24 @@ void CPauseScreenBase::OnWidgetScroll(CGuiWidget* widget, const boo::SScrollDelt else return; } - if (accumY < 0) do { - if (x10_mode == EMode::RightTable && x18_firstViewRightSel + 5 < GetRightTableCount()) { - /* Simulate selection change */ - int oldSel = x84_tablegroup_rightlog->GetUserSelection(); - x84_tablegroup_rightlog->SelectWorker(6); - OnTableSelectionChange(x84_tablegroup_rightlog, oldSel); - } - } while (++accumY < 0); - else if (accumY > 0) do { - if (x10_mode == EMode::RightTable && x18_firstViewRightSel > 0) { - /* Simulate selection change */ - int oldSel = x84_tablegroup_rightlog->GetUserSelection(); - x84_tablegroup_rightlog->SelectWorker(0); - OnTableSelectionChange(x84_tablegroup_rightlog, oldSel); - } - } while (--accumY > 0); + if (accumY < 0) + do { + if (x10_mode == EMode::RightTable && x18_firstViewRightSel + 5 < GetRightTableCount()) { + /* Simulate selection change */ + int oldSel = x84_tablegroup_rightlog->GetUserSelection(); + x84_tablegroup_rightlog->SelectWorker(6); + OnTableSelectionChange(x84_tablegroup_rightlog, oldSel); + } + } while (++accumY < 0); + else if (accumY > 0) + do { + if (x10_mode == EMode::RightTable && x18_firstViewRightSel > 0) { + /* Simulate selection change */ + int oldSel = x84_tablegroup_rightlog->GetUserSelection(); + x84_tablegroup_rightlog->SelectWorker(0); + OnTableSelectionChange(x84_tablegroup_rightlog, oldSel); + } + } while (--accumY > 0); } else if (widget == x174_textpane_body) { if (accumY < 0) m_bodyDownClicked = true; diff --git a/Runtime/MP1/CPlayMovie.cpp b/Runtime/MP1/CPlayMovie.cpp index afb06c32f..43dddefc6 100644 --- a/Runtime/MP1/CPlayMovie.cpp +++ b/Runtime/MP1/CPlayMovie.cpp @@ -28,11 +28,7 @@ void CPlayMovie::Draw() { } } -void CPlayMovie::DrawVideo() { - -} -void CPlayMovie::DrawText() { - -} +void CPlayMovie::DrawVideo() {} +void CPlayMovie::DrawText() {} } // namespace metaforce::MP1 diff --git a/Runtime/MP1/CPlayMovie.hpp b/Runtime/MP1/CPlayMovie.hpp index ee48af20e..a25f45d62 100644 --- a/Runtime/MP1/CPlayMovie.hpp +++ b/Runtime/MP1/CPlayMovie.hpp @@ -34,6 +34,7 @@ private: void DrawVideo(); void DrawText(); + public: explicit CPlayMovie(EWhichMovie which); EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; diff --git a/Runtime/MP1/CSamusDoll.cpp b/Runtime/MP1/CSamusDoll.cpp index 877339a33..ee15f4d94 100644 --- a/Runtime/MP1/CSamusDoll.cpp +++ b/Runtime/MP1/CSamusDoll.cpp @@ -343,9 +343,8 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) { xc8_suitModel0->GetAnimationData()->SubstituteModelData(backupModelData); } - x134_suitModelBoots->InvSuitDraw(CModelData::EWhichModel::Normal, zeus::CTransform(), - x24c_actorLights.get(), zeus::CColor(1.f, alpha), - zeus::CColor(1.f, alpha * bootsPulse)); + x134_suitModelBoots->InvSuitDraw(CModelData::EWhichModel::Normal, zeus::CTransform(), x24c_actorLights.get(), + zeus::CColor(1.f, alpha), zeus::CColor(1.f, alpha * bootsPulse)); { CGraphics::SetModelMatrix(gunXf); diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index b9542f0ee..f331b89f7 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -298,9 +298,9 @@ void CSamusHud::InitializeDamageLight() { g_tweakGuiColors->GetHudDamageLightColor(), CGuiWidget::EGuiModelDrawFlags::Alpha, false, false, "DamageSpotLight"s); - std::shared_ptr light = std::make_shared( - parms, CLight::BuildSpot(zeus::skZero3f, zeus::skForward, zeus::skWhite, - g_tweakGui->GetHudDamageLightSpotAngle())); + std::shared_ptr light = + std::make_shared(parms, CLight::BuildSpot(zeus::skZero3f, zeus::skForward, zeus::skWhite, + g_tweakGui->GetHudDamageLightSpotAngle())); x3d4_damageLight = light.get(); x3d4_damageLight->SetColor(zeus::skBlack); @@ -366,7 +366,7 @@ void CSamusHud::UpdateEnergy(float dt, const CStateManager& mgr, bool init) { while (curLastTankEnergy > CPlayerState::GetBaseHealthCapacity()) curLastTankEnergy -= CPlayerState::GetEnergyTankCapacity(); x28c_energyIntf->SetCurrEnergy(lastTankEnergy, - (curLastTankEnergy > lastTankEnergy) != (x2d0_playerHealth > energy)); + (curLastTankEnergy > lastTankEnergy) != (x2d0_playerHealth > energy)); } x2d0_playerHealth = energy; if (x28c_energyIntf) { @@ -859,8 +859,7 @@ void CSamusHud::UpdateHudDynamicLights(float dt, const CStateManager& mgr) { lightAdd += x33c_lights->GetAmbientColor() * zeus::CColor(0.25f, 1.f); zeus::CVector3f revDir = -brightestLight.GetWorldTransform().basis[1]; float foreDot = revDir.dot(zeus::skForward); - x5d8_guiLights[3]->SetO2WTransform( - zeus::lookAt(zeus::skZero3f, zeus::skForward * 2.f * foreDot - revDir)); + x5d8_guiLights[3]->SetO2WTransform(zeus::lookAt(zeus::skZero3f, zeus::skForward * 2.f * foreDot - revDir)); x5d8_guiLights[3]->SetColor(g_tweakGui->GetHudReflectivityLightColor() * brightestLight.GetIntermediateColor()); x5d8_guiLights[3]->SetAmbientLightColor(lightAdd); } diff --git a/Runtime/MP1/CSaveGameScreenTouchBarMac.mm b/Runtime/MP1/CSaveGameScreenTouchBarMac.mm index 085b7f538..7ac17930d 100644 --- a/Runtime/MP1/CSaveGameScreenTouchBarMac.mm +++ b/Runtime/MP1/CSaveGameScreenTouchBarMac.mm @@ -1,125 +1,101 @@ -#include #include "CSaveGameScreenTouchBar.hpp" #include "GameGlobalObjects.hpp" #include "MP1/MP1.hpp" +#include #if !__has_feature(objc_arc) #error ARC Required #endif -@interface SaveGameScreenTouchBar : NSObject -{ +@interface SaveGameScreenTouchBar : NSObject { @public - NSString* _opts[3]; - int _opt; + NSString *_opts[3]; + int _opt; } --(IBAction)onOpt0:(id)sender; --(IBAction)onOpt1:(id)sender; --(IBAction)onOpt2:(id)sender; +- (IBAction)onOpt0:(id)sender; +- (IBAction)onOpt1:(id)sender; +- (IBAction)onOpt2:(id)sender; @end @implementation SaveGameScreenTouchBar -- (NSTouchBar*)makeTouchBar -{ - NSTouchBar* touchBar = [NSTouchBar new]; +- (NSTouchBar *)makeTouchBar { + NSTouchBar *touchBar = [NSTouchBar new]; + touchBar.delegate = self; + id items = @[ @"saveUIGroup" ]; + touchBar.customizationRequiredItemIdentifiers = items; + touchBar.defaultItemIdentifiers = items; + touchBar.principalItemIdentifier = @"saveUIGroup"; + return touchBar; +} +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { + if ([identifier isEqualToString:@"saveUIGroup"]) { + NSGroupTouchBarItem *item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; + NSTouchBar *touchBar = [NSTouchBar new]; touchBar.delegate = self; - id items = @[@"saveUIGroup"]; + id items; + items = [NSMutableArray arrayWithCapacity:3]; + [items addObject:@"back"]; + for (int i = 0; i < 3 && _opts[i]; ++i) + [items addObject:[NSString stringWithFormat:@"opt%d", i]]; touchBar.customizationRequiredItemIdentifiers = items; touchBar.defaultItemIdentifiers = items; - touchBar.principalItemIdentifier = @"saveUIGroup"; - return touchBar; + item.groupTouchBar = touchBar; + return item; + } else if ([identifier isEqualToString:@"opt0"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:_opts[0] target:self action:@selector(onOpt0:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"opt1"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:_opts[1] target:self action:@selector(onOpt1:)]; + item.view = button; + return item; + } else if ([identifier isEqualToString:@"opt2"]) { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSButton *button = [NSButton buttonWithTitle:_opts[2] target:self action:@selector(onOpt2:)]; + item.view = button; + return item; + } + return nil; } --(NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier -{ - if ([identifier isEqualToString:@"saveUIGroup"]) - { - NSGroupTouchBarItem* item = [[NSGroupTouchBarItem alloc] initWithIdentifier:identifier]; - NSTouchBar* touchBar = [NSTouchBar new]; - touchBar.delegate = self; - id items; - items = [NSMutableArray arrayWithCapacity:3]; - [items addObject:@"back"]; - for (int i=0 ; i<3 && _opts[i] ; ++i) - [items addObject:[NSString stringWithFormat:@"opt%d", i]]; - touchBar.customizationRequiredItemIdentifiers = items; - touchBar.defaultItemIdentifiers = items; - item.groupTouchBar = touchBar; - return item; - } - else if ([identifier isEqualToString:@"opt0"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:_opts[0] target:self action:@selector(onOpt0:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"opt1"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:_opts[1] target:self action:@selector(onOpt1:)]; - item.view = button; - return item; - } - else if ([identifier isEqualToString:@"opt2"]) - { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; - NSButton* button = [NSButton buttonWithTitle:_opts[2] target:self action:@selector(onOpt2:)]; - item.view = button; - return item; - } - return nil; +- (IBAction)onOpt0:(id)sender { + _opt = 0; } --(IBAction)onOpt0:(id)sender -{ - _opt = 0; +- (IBAction)onOpt1:(id)sender { + _opt = 1; } --(IBAction)onOpt1:(id)sender -{ - _opt = 1; -} --(IBAction)onOpt2:(id)sender -{ - _opt = 2; +- (IBAction)onOpt2:(id)sender { + _opt = 2; } @end -namespace metaforce::MP1 -{ +namespace metaforce::MP1 { + +class CSaveGameScreenTouchBarMac : public CSaveGameScreenTouchBar { + SaveGameScreenTouchBar *m_touchBar; -class CSaveGameScreenTouchBarMac : public CSaveGameScreenTouchBar -{ - SaveGameScreenTouchBar* m_touchBar; public: - CSaveGameScreenTouchBarMac() - { - m_touchBar = [SaveGameScreenTouchBar new]; - m_touchBar->_opt = -1; - } - int PopOption() - { - if (m_touchBar->_opt != -1) - { - int opt = m_touchBar->_opt; - m_touchBar->_opt = -1; - return opt; - } - return -1; - } - void SetUIOpts(std::u16string_view opt0, - std::u16string_view opt1, - std::u16string_view opt2) - { - m_touchBar->_opts[0] = opt0.size() ? [NSString stringWithUTF8String:hecl::Char16ToUTF8(opt0).c_str()] : nil; - m_touchBar->_opts[1] = opt1.size() ? [NSString stringWithUTF8String:hecl::Char16ToUTF8(opt1).c_str()] : nil; - m_touchBar->_opts[2] = opt2.size() ? [NSString stringWithUTF8String:hecl::Char16ToUTF8(opt2).c_str()] : nil; - g_Main->GetMainWindow()->setTouchBarProvider((__bridge_retained void*)m_touchBar); + CSaveGameScreenTouchBarMac() { + m_touchBar = [SaveGameScreenTouchBar new]; + m_touchBar->_opt = -1; + } + int PopOption() { + if (m_touchBar->_opt != -1) { + int opt = m_touchBar->_opt; + m_touchBar->_opt = -1; + return opt; } + return -1; + } + void SetUIOpts(std::u16string_view opt0, std::u16string_view opt1, std::u16string_view opt2) { + m_touchBar->_opts[0] = opt0.size() ? [NSString stringWithUTF8String:hecl::Char16ToUTF8(opt0).c_str()] : nil; + m_touchBar->_opts[1] = opt1.size() ? [NSString stringWithUTF8String:hecl::Char16ToUTF8(opt1).c_str()] : nil; + m_touchBar->_opts[2] = opt2.size() ? [NSString stringWithUTF8String:hecl::Char16ToUTF8(opt2).c_str()] : nil; + g_Main->GetMainWindow()->setTouchBarProvider((__bridge_retained void *)m_touchBar); + } }; -std::unique_ptr NewSaveUITouchBar() -{ - return std::make_unique(); -} +std::unique_ptr NewSaveUITouchBar() { return std::make_unique(); } } diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index c7411b4f8..8351c1563 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -70,7 +70,6 @@ #include #include - #include "Runtime/MP1/CCredits.hpp" #include @@ -464,7 +463,7 @@ void CMain::Give(hecl::Console* console, const std::vector& args) { if (type == "all") { for (u32 item = 0; item < u32(CPlayerState::EItemType::Max); ++item) { pState->ReInitializePowerUp(CPlayerState::EItemType(item), - CPlayerState::GetPowerUpMaxValue(CPlayerState::EItemType(item))); + CPlayerState::GetPowerUpMaxValue(CPlayerState::EItemType(item))); pState->IncrPickup(CPlayerState::EItemType(item), CPlayerState::GetPowerUpMaxValue(CPlayerState::EItemType(item))); } @@ -894,7 +893,6 @@ void CMain::WarmupShaders() { return true; }); - m_warmupIt = m_warmupTags.begin(); WarmupLog.report(logvisor::Info, FMT_STRING("Began warmup of {} objects"), m_warmupTags.size()); diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index c9049617a..f055d3b56 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -280,7 +280,8 @@ public: static void UpdateDiscordPresence(CAssetId worldSTRG = {}); - // int RsMain(int argc, boo::SystemChar** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend); + // int RsMain(int argc, boo::SystemChar** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& + // backend); void Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarManager* cvarManager, boo::IWindow* window, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) override; void WarmupShaders() override; diff --git a/Runtime/MP1/World/CActorContraption.cpp b/Runtime/MP1/World/CActorContraption.cpp index a516c35f1..56377156c 100644 --- a/Runtime/MP1/World/CActorContraption.cpp +++ b/Runtime/MP1/World/CActorContraption.cpp @@ -83,8 +83,8 @@ void MP1::CActorContraption::DoUserAnimEvent(CStateManager& mgr, const CInt32POI } CFlameThrower* MP1::CActorContraption::CreateFlameThrower(std::string_view name, CStateManager& mgr) { - const auto it = std::find_if(x2e8_children.cbegin(), x2e8_children.cend(), - [&name](const auto& p) { return p.second == name; }); + const auto it = + std::find_if(x2e8_children.cbegin(), x2e8_children.cend(), [&name](const auto& p) { return p.second == name; }); if (it != x2e8_children.cend()) { return static_cast(mgr.ObjectById(it->first)); diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index a701a2082..1e5aff853 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -75,9 +75,9 @@ CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& in EBoneTrackingFlags::None) , x930_aabox(GetBoundingBox(), GetMaterialList()) , x958_iceProjectile(babyData.x8_fireballWeapon, babyData.xc_fireballDamage) -, x984_flameThrowerDesc(babyData.x44_fireBreathWeapon.IsValid() ? - g_SimplePool->GetObj({SBIG('WPSC'), babyData.x44_fireBreathWeapon}) - : g_SimplePool->GetObj("FlameThrower"sv)) +, x984_flameThrowerDesc(babyData.x44_fireBreathWeapon.IsValid() + ? g_SimplePool->GetObj({SBIG('WPSC'), babyData.x44_fireBreathWeapon}) + : g_SimplePool->GetObj("FlameThrower"sv)) , x98c_dVuln(pInfo.GetDamageVulnerability()) , xa00_shellHitPoints(babyData.GetShellHitPoints()) { TLockedToken model = g_SimplePool->GetObj({SBIG('CMDL'), babyData.x138_noShellModel}); @@ -96,9 +96,9 @@ CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& in x460_knockBackController.SetAutoResetImpulse(true); x460_knockBackController.SetEnableShock(true); x460_knockBackController.SetEnableExplodeDeath(true); - x8d4_stepBackwardDist = - GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * - GetModelData()->GetScale().y(); // B_backward_sheegoth + x8d4_stepBackwardDist = GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), + CPASAnimParm::FromEnum(0))) * + GetModelData()->GetScale().y(); // B_backward_sheegoth xa08_noShellModel->SetLayoutInfo(GetModelData()->GetAnimationData()->GetModelData()->GetLayoutInfo()); MakeThermalColdAndHot(); } @@ -156,7 +156,8 @@ void CBabygoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM } case EScriptObjectMessage::InitializedInArea: { x6ec_pathSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea); - x7d0_approachPathSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea); + x7d0_approachPathSearch.SetArea( + mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea); if (x6e8_teamMgr == kInvalidUniqueId) x6e8_teamMgr = CTeamAiMgr::GetTeamAiMgr(*this, mgr); break; @@ -202,7 +203,7 @@ void CBabygoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM x8e8_interestTimer = 0.f; if (!TCastToPtr(mgr.ObjectById(uid))) ApplyDamage(mgr, uid); - break; + break; } case EScriptObjectMessage::SuspendedMove: { if (x928_colActMgr) @@ -253,13 +254,14 @@ void CBabygoth::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, E if (zeus::CVector3f::getAngleDiff(GetTransform().basis[1], delta) > zeus::degToRad(30.f)) { if (delta.canBeNormalized()) { pos = zeus::CVector3f::slerp(GetTransform().basis[1], delta.normalized(), zeus::degToRad(30.f)) * - delta.magnitude() + xf.origin; + delta.magnitude() + + xf.origin; } else { pos = xf.basis[1] * delta.magnitude() + xf.origin; } } - LaunchProjectile(zeus::lookAt(xf.origin, pos), mgr, 4, EProjectileAttrib::None, - false, {}, 0xffff, false, zeus::skOne3f); + LaunchProjectile(zeus::lookAt(xf.origin, pos), mgr, 4, EProjectileAttrib::None, false, {}, 0xffff, false, + zeus::skOne3f); return; } case EUserEventType::DamageOn: { @@ -325,7 +327,8 @@ void CBabygoth::SetupCollisionManager(CStateManager& mgr) { SetupHealthInfo(mgr); - SetMaterialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, + SetMaterialFilter(CMaterialFilter::MakeIncludeExclude( + {EMaterialTypes::Solid}, {EMaterialTypes::CollisionActor, EMaterialTypes::AIPassthrough, EMaterialTypes::Player})); AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr); x928_colActMgr->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough}); @@ -427,7 +430,8 @@ zeus::CVector3f CBabygoth::GetAimPosition(const CStateManager& mgr, float dt) co if (TCastToConstPtr cact = mgr.GetObjectById(x9f6_mouthCollisionActor)) mouthZ = cact->GetTranslation().z(); float t = zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(), - (mgr.GetPlayer().GetTranslation() - GetTranslation()).toVec2f()) / M_PIF; + (mgr.GetPlayer().GetTranslation() - GetTranslation()).toVec2f()) / + M_PIF; return zeus::CVector3f::lerp(zeus::CVector3f(shellAvgPos.toVec2f(), mouthZ), zeus::CVector3f(shellAvgPos.toVec2f(), shellAvgPos.z()), t); } else { @@ -892,7 +896,8 @@ void CBabygoth::PathFind(CStateManager& mgr, EStateMsg msg, float arg) { CPatterned::PathFind(mgr, msg, arg); } else if (msg == EStateMsg::Update) { SetPathFindMode(EPathFindMode::Normal); - if (GetSearchPath() && !PathShagged(mgr, 0.f) && x6ec_pathSearch.GetCurrentWaypoint() < x6ec_pathSearch.GetWaypoints().size() - 1) { + if (GetSearchPath() && !PathShagged(mgr, 0.f) && + x6ec_pathSearch.GetCurrentWaypoint() < x6ec_pathSearch.GetWaypoints().size() - 1) { CPatterned::PathFind(mgr, msg, arg); x8e8_interestTimer = 0.f; zeus::CVector3f move = x450_bodyController->GetCommandMgr().GetMoveVector(); @@ -921,7 +926,8 @@ void CBabygoth::UpdateAttackTimeLeft(CStateManager& mgr) { float mult = x56c_shellState == EShellState::Destroyed ? 0.6f : 1.f; x8d8_attackTimeLeft = (mgr.GetActiveRandom()->Float() * x308_attackTimeVariation + x304_averageAttackTime) * mult; x8e4_fireballAttackTimeLeft = (mgr.GetActiveRandom()->Float() * x570_babyData.GetFireballAttackVariance() + - x570_babyData.GetFireballAttackTime()) * mult; + x570_babyData.GetFireballAttackTime()) * + mult; } void CBabygoth::SpecialAttack(CStateManager& mgr, EStateMsg state, float) { @@ -1031,9 +1037,10 @@ void CBabygoth::Attack(CStateManager& mgr, EStateMsg state, float dt) { x8dc_attackTimer = 0.f; float maxSpeed = x450_bodyController->GetBodyStateInfo().GetMaxSpeed(); x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::Clamped); - x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(0.f, - (maxSpeed > 0.f) ? x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed( - pas::ELocomotionAnim::Walk) / maxSpeed : 1.f); + x450_bodyController->GetCommandMgr().SetSteeringSpeedRange( + 0.f, (maxSpeed > 0.f) + ? x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Walk) / maxSpeed + : 1.f); ExtendCollisionActorTouchBounds(mgr, zeus::skZero3f); CTeamAiMgr::ResetTeamAiRole(CTeamAiMgr::EAttackType::Melee, mgr, x6e8_teamMgr, GetUniqueId(), true); } @@ -1085,7 +1092,8 @@ void CBabygoth::ProjectileAttack(CStateManager& mgr, EStateMsg state, float) { bool CBabygoth::Leash(CStateManager& mgr, float) { if ((x3a0_latestLeashPosition - GetTranslation()).magSquared() > x3c8_leashRadius * x3c8_leashRadius) return (mgr.GetPlayer().GetTranslation() - GetTranslation()).magSquared() > - x3cc_playerLeashRadius * x3cc_playerLeashRadius && x3d4_curPlayerLeashTime > x3d0_playerLeashTime; + x3cc_playerLeashRadius * x3cc_playerLeashRadius && + x3d4_curPlayerLeashTime > x3d0_playerLeashTime; return false; } @@ -1113,8 +1121,8 @@ void CBabygoth::DestroyShell(CStateManager& mgr) { xa04_drawMaterialIdx = 0; } -void CBabygoth::CrackShell(CStateManager& mgr, const TLockedToken& desc, - const zeus::CTransform& xf, u16 sfx, bool nonEmitterSfx) { +void CBabygoth::CrackShell(CStateManager& mgr, const TLockedToken& desc, const zeus::CTransform& xf, + u16 sfx, bool nonEmitterSfx) { mgr.AddObject(new CExplosion(desc, mgr.AllocateUniqueId(), true, CEntityInfo(GetAreaIdAlways(), CEntity::NullConnectionList), "Babygoth Shell Crack Fx"sv, xf, 0, GetModelData()->GetScale(), zeus::skWhite)); @@ -1163,7 +1171,8 @@ bool CBabygoth::ShouldAttack(CStateManager& mgr, float arg) { x8d8_attackTimeLeft <= 0.f && x8e0_attackCooldownTimeLeft <= 0.f) { zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f); if (x450_bodyController->GetBodyStateInfo().GetMaxSpeed() * x570_babyData.x160_timeUntilAttack > - (aimPos - GetTranslation()).magnitude() && !ShouldTurn(mgr, zeus::degToRad(25.f)) && + (aimPos - GetTranslation()).magnitude() && + !ShouldTurn(mgr, zeus::degToRad(25.f)) && !IsPatternObstructed(mgr, GetLctrTransform(x9f4_mouthLocator).origin, aimPos)) { if (TCastToPtr aimgr = mgr.ObjectById(x6e8_teamMgr)) { if (aimgr->IsPartOfTeam(GetUniqueId())) @@ -1180,7 +1189,7 @@ bool CBabygoth::ShouldSpecialAttack(CStateManager& mgr, float arg) { zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f); zeus::CVector3f mouthPos = GetLctrTransform(x9f4_mouthLocator).origin; return (aimPos - mouthPos).magSquared() >= x300_maxAttackRange * x300_maxAttackRange && - !ShouldTurn(mgr, zeus::degToRad(25.f)) && !IsPatternObstructed(mgr, mouthPos, aimPos); + !ShouldTurn(mgr, zeus::degToRad(25.f)) && !IsPatternObstructed(mgr, mouthPos, aimPos); } return false; } diff --git a/Runtime/MP1/World/CBeetle.cpp b/Runtime/MP1/World/CBeetle.cpp index 50080b760..d138ece36 100644 --- a/Runtime/MP1/World/CBeetle.cpp +++ b/Runtime/MP1/World/CBeetle.cpp @@ -32,10 +32,11 @@ CBeetle::CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info, , x7ac_tailVuln(tailVuln) , x814_attackDelayTimer(initialAttackDelay) , x834_retreatTime(retreatTime) { - x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1))); - x5a4_jumpBackwardDist = - x64_modelData->GetScale().y() * - GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))); + x5a0_headbuttDist = GetAnimationDistance( + CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1))); + x5a4_jumpBackwardDist = x64_modelData->GetScale().y() * + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), + CPASAnimParm::FromEnum(0))); MakeThermalColdAndHot(); if (x3fc_flavor == EFlavorType::One) x460_knockBackController.SetLocomotionDuringElectrocution(true); @@ -700,8 +701,8 @@ void CBeetle::TurnAround(CStateManager& mgr, EStateMsg msg, float dt) { } else { zeus::CVector3f thisToPlayer = mgr.GetPlayer().GetTranslation() - GetTranslation(); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( - zeus::skZero3f, - (thisToPlayer.magnitude() > FLT_EPSILON) ? thisToPlayer.normalized() : zeus::skZero3f, 1.f)); + zeus::skZero3f, (thisToPlayer.magnitude() > FLT_EPSILON) ? thisToPlayer.normalized() : zeus::skZero3f, + 1.f)); } break; case 2: diff --git a/Runtime/MP1/World/CBloodFlower.cpp b/Runtime/MP1/World/CBloodFlower.cpp index 049cc63e3..5c50d1a26 100644 --- a/Runtime/MP1/World/CBloodFlower.cpp +++ b/Runtime/MP1/World/CBloodFlower.cpp @@ -116,7 +116,8 @@ void CBloodFlower::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node CPatterned::DoUserAnimEvent(mgr, node, type, dt); } -void CBloodFlower::LaunchPollenProjectile(const zeus::CTransform& xf, CStateManager& mgr, float var_f1, s32 maxProjectiles) { +void CBloodFlower::LaunchPollenProjectile(const zeus::CTransform& xf, CStateManager& mgr, float var_f1, + s32 maxProjectiles) { CProjectileInfo* proj = GetProjectileInfo(); TLockedToken projToken = proj->Token(); @@ -137,8 +138,7 @@ void CBloodFlower::LaunchPollenProjectile(const zeus::CTransform& xf, CStateMana CreateArcProjectile(mgr, GetProjectileInfo()->Token(), zeus::CTransform::Translate(xf.origin), GetProjectileInfo()->GetDamage(), kInvalidUniqueId)) { targProj->ProjectileWeapon().SetVelocity(CProjectileWeapon::GetTickPeriod() * vel); - targProj->ProjectileWeapon().SetGravity(CProjectileWeapon::GetTickPeriod() * - zeus::CVector3f(0.f, 0.f, -4.905f)); + targProj->ProjectileWeapon().SetGravity(CProjectileWeapon::GetTickPeriod() * zeus::CVector3f(0.f, 0.f, -4.905f)); mgr.AddObject(targProj); } } diff --git a/Runtime/MP1/World/CBouncyGrenade.cpp b/Runtime/MP1/World/CBouncyGrenade.cpp index 3f687846e..785852a43 100644 --- a/Runtime/MP1/World/CBouncyGrenade.cpp +++ b/Runtime/MP1/World/CBouncyGrenade.cpp @@ -115,7 +115,7 @@ void CBouncyGrenade::Think(float dt, CStateManager& mgr) { const zeus::CTransform& orientation = GetTransform().getRotation(); const zeus::CVector3f& translation = GetTranslation(); const zeus::CVector3f& scale = GetModelData()->GetScale(); - auto UpdateElementGen = [ orientation, translation, scale, dt ](CElementGen & gen) { + auto UpdateElementGen = [orientation, translation, scale, dt](CElementGen& gen) { gen.SetOrientation(orientation); gen.SetGlobalTranslation(translation); gen.SetGlobalScale(scale); diff --git a/Runtime/MP1/World/CBurrower.cpp b/Runtime/MP1/World/CBurrower.cpp index b898c9980..ce323ffb9 100644 --- a/Runtime/MP1/World/CBurrower.cpp +++ b/Runtime/MP1/World/CBurrower.cpp @@ -160,8 +160,8 @@ void CBurrower::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, E const zeus::CVector3f interPos = GetProjectileInfo()->PredictInterceptPos(gunPos, aimPos, mgr.GetPlayer(), true, dt); const zeus::CTransform gunXf = zeus::lookAt(gunPos, interPos); - LaunchProjectile(gunXf, mgr, 1, EProjectileAttrib::None, false, x67c_visorParticle, - x6aa_visorSfx, false, GetModelData()->GetScale()); + LaunchProjectile(gunXf, mgr, 1, EProjectileAttrib::None, false, x67c_visorParticle, x6aa_visorSfx, false, + GetModelData()->GetScale()); return; } diff --git a/Runtime/MP1/World/CBurrower.hpp b/Runtime/MP1/World/CBurrower.hpp index b0ad4dfcd..f664e9fb4 100644 --- a/Runtime/MP1/World/CBurrower.hpp +++ b/Runtime/MP1/World/CBurrower.hpp @@ -22,6 +22,7 @@ class CBurrower : public CPatterned { s16 x6aa_visorSfx; bool x6ac_24_doFacePlayer : 1 = false; bool x6ac_25_inAir : 1 = false; + public: DEFINE_PATTERNED(Burrower); CBurrower(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, diff --git a/Runtime/MP1/World/CChozoGhost.cpp b/Runtime/MP1/World/CChozoGhost.cpp index b6464c02d..26b6cc759 100644 --- a/Runtime/MP1/World/CChozoGhost.cpp +++ b/Runtime/MP1/World/CChozoGhost.cpp @@ -105,11 +105,14 @@ CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo x578_.Token().Lock(); x5a0_.Token().Lock(); x668_ = GetModelData()->GetScale().z() * - GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0))); + GetAnimationDistance( + CPASAnimParmData(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0))); x66c_ = GetModelData()->GetScale().z() * - GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Slide, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f))); + GetAnimationDistance( + CPASAnimParmData(pas::EAnimationState::Slide, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f))); x670_ = GetModelData()->GetScale().z() * - GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(1))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(2), + CPASAnimParm::FromEnum(1))); if (projectileVisorEffect.IsValid()) x640_projectileVisor = g_SimplePool->GetObj({SBIG('PART'), projectileVisorEffect}); diff --git a/Runtime/MP1/World/CDrone.cpp b/Runtime/MP1/World/CDrone.cpp index 866980c14..9e25349a4 100644 --- a/Runtime/MP1/World/CDrone.cpp +++ b/Runtime/MP1/World/CDrone.cpp @@ -913,8 +913,8 @@ void CDrone::Burn(float duration, float damage) { CPathFindSearch* CDrone::GetSearchPath() { return &x6b0_pathFind; } -void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, - EntityList& listOut, float radius, CStateManager& mgr) { +void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, EntityList& listOut, float radius, + CStateManager& mgr) { const zeus::CVector3f pos = GetTranslation(); mgr.BuildNearList(listOut, zeus::CAABox(pos - radius, pos + radius), CMaterialFilter::MakeIncludeExclude({includeMat}, {excludeMat}), nullptr); diff --git a/Runtime/MP1/World/CDrone.hpp b/Runtime/MP1/World/CDrone.hpp index 4f6ec87fb..7ac3af087 100644 --- a/Runtime/MP1/World/CDrone.hpp +++ b/Runtime/MP1/World/CDrone.hpp @@ -168,8 +168,8 @@ public: void Burn(float duration, float damage) override; void Dead(CStateManager& mgr, EStateMsg msg, float arg) override; CPathFindSearch* GetSearchPath() override; - virtual void BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, - EntityList& listOut, float radius, CStateManager& mgr); + virtual void BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, EntityList& listOut, float radius, + CStateManager& mgr); virtual void SetLightEnabled(CStateManager& mgr, bool activate); virtual void SetVisorFlareEnabled(CStateManager& mgr, bool activate); virtual void UpdateVisorFlare(CStateManager& mgr); diff --git a/Runtime/MP1/World/CElitePirate.cpp b/Runtime/MP1/World/CElitePirate.cpp index 1e483a9df..98fde2c44 100644 --- a/Runtime/MP1/World/CElitePirate.cpp +++ b/Runtime/MP1/World/CElitePirate.cpp @@ -211,7 +211,8 @@ void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta CreateGrenadeLauncher(mgr, x772_launcherId); const auto& bodyStateInfo = x450_bodyController->GetBodyStateInfo(); if (bodyStateInfo.GetMaxSpeed() > 0.f) { - x7a4_steeringSpeed = (0.99f * bodyStateInfo.GetLocomotionSpeed(pas::ELocomotionAnim::Walk)) / bodyStateInfo.GetMaxSpeed(); + x7a4_steeringSpeed = + (0.99f * bodyStateInfo.GetLocomotionSpeed(pas::ELocomotionAnim::Walk)) / bodyStateInfo.GetMaxSpeed(); } x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::FullSpeed); x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(x7a4_steeringSpeed, x7a4_steeringSpeed); @@ -511,7 +512,8 @@ void CElitePirate::Generate(CStateManager& mgr, EStateMsg msg, float) { } else { x568_state = EState::Zero; } - } else if (x568_state == EState::Two && x450_bodyController->GetCurrentStateId() != pas::EAnimationState::Generate) { + } else if (x568_state == EState::Two && + x450_bodyController->GetCurrentStateId() != pas::EAnimationState::Generate) { x568_state = EState::Over; } } else if (msg == EStateMsg::Deactivate) { @@ -1156,8 +1158,7 @@ bool CElitePirate::ShouldCallForBackupFromLauncher(const CStateManager& mgr, TUn return x7a8_pathShaggedTime >= 3.f; } -bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr, - const EntityList& charNearList, +bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr, const EntityList& charNearList, const zeus::CVector3f& projectilePos) const { const float distance = (projectilePos - GetTranslation()).magSquared(); for (const auto& id : charNearList) { diff --git a/Runtime/MP1/World/CEnergyBall.cpp b/Runtime/MP1/World/CEnergyBall.cpp index 18a1a3f64..d7f375c4b 100644 --- a/Runtime/MP1/World/CEnergyBall.cpp +++ b/Runtime/MP1/World/CEnergyBall.cpp @@ -99,4 +99,4 @@ void CEnergyBall::Attack(CStateManager& mgr, EStateMsg msg, float arg) { } } void CEnergyBall::sub8029f4a8(CStateManager& mgr) {} -} \ No newline at end of file +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/World/CEnergyBall.hpp b/Runtime/MP1/World/CEnergyBall.hpp index 6bcd59cfe..668163f06 100644 --- a/Runtime/MP1/World/CEnergyBall.hpp +++ b/Runtime/MP1/World/CEnergyBall.hpp @@ -28,6 +28,7 @@ class CEnergyBall : public CPatterned { float x5e8_; void sub8029f4a8(CStateManager& mgr); + public: DEFINE_PATTERNED(EnergyBall); CEnergyBall(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, @@ -36,11 +37,10 @@ public: const CAssetId& a3, s16 sfxId2, float f3, float f4, const CAssetId& a4, const CDamageInfo& dInfo2, float f5); - void Think(float dt, CStateManager& mgr) override; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override; void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) override; void Generate(CStateManager& mgr, EStateMsg msg, float arg) override; void Attack(CStateManager& mgr, EStateMsg msg, float arg) override; }; -} +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/World/CEyeball.cpp b/Runtime/MP1/World/CEyeball.cpp index 7c723e130..0e09f6f6c 100644 --- a/Runtime/MP1/World/CEyeball.cpp +++ b/Runtime/MP1/World/CEyeball.cpp @@ -129,9 +129,9 @@ void CEyeball::CreateBeam(CStateManager& mgr) { 150.f); x5ec_projectileId = mgr.AllocateUniqueId(); mgr.AddObject(new CPlasmaProjectile(x5b4_projectileInfo.Token(), "EyeBall_Beam"sv, EWeaponType::AI, beamInfo, - zeus::CTransform(), EMaterialTypes::Immovable, - x5b4_projectileInfo.GetDamage(), x5ec_projectileId, GetAreaIdAlways(), - GetUniqueId(), {}, false, EProjectileAttrib::KeepInCinematic)); + zeus::CTransform(), EMaterialTypes::Immovable, x5b4_projectileInfo.GetDamage(), + x5ec_projectileId, GetAreaIdAlways(), GetUniqueId(), {}, false, + EProjectileAttrib::KeepInCinematic)); } void CEyeball::InActive(CStateManager&, EStateMsg msg, float) { diff --git a/Runtime/MP1/World/CFlaahgraProjectile.hpp b/Runtime/MP1/World/CFlaahgraProjectile.hpp index 018c90824..4c97fa5fc 100644 --- a/Runtime/MP1/World/CFlaahgraProjectile.hpp +++ b/Runtime/MP1/World/CFlaahgraProjectile.hpp @@ -12,7 +12,7 @@ public: CFlaahgraProjectile(bool bigStrike, const TToken& desc, const zeus::CTransform& xf, const CDamageInfo& damage, TUniqueId uid, TAreaId aid, TUniqueId owner); - void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager &mgr) override; + void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override; }; } // namespace metaforce::MP1 diff --git a/Runtime/MP1/World/CFlickerBat.cpp b/Runtime/MP1/World/CFlickerBat.cpp index 7d673675f..45abe88ac 100644 --- a/Runtime/MP1/World/CFlickerBat.cpp +++ b/Runtime/MP1/World/CFlickerBat.cpp @@ -230,7 +230,7 @@ void CFlickerBat::CheckStaticIntersection(CStateManager& mgr) { float mag = diff.magnitude(); diff *= zeus::CVector3f(1.f / mag); x580_26_inLOS = CGameCollision::RayStaticIntersectionBool(mgr, camPos, diff, mag, - CMaterialFilter::MakeExclude({EMaterialTypes::SeeThrough})); + CMaterialFilter::MakeExclude({EMaterialTypes::SeeThrough})); } void CFlickerBat::NotifyNeighbors(CStateManager& mgr) { diff --git a/Runtime/MP1/World/CFlyingPirate.cpp b/Runtime/MP1/World/CFlyingPirate.cpp index 20d34f2f6..4842f2411 100644 --- a/Runtime/MP1/World/CFlyingPirate.cpp +++ b/Runtime/MP1/World/CFlyingPirate.cpp @@ -322,7 +322,8 @@ CFlyingPirate::CFlyingPirate(TUniqueId uid, std::string_view name, const CEntity x864_missileSegments.push_back(animData->GetLocatorSegId("L_Missile_LCTR"sv)); x864_missileSegments.push_back(animData->GetLocatorSegId("R_Missile_LCTR"sv)); x850_height = modelData->GetScale().x() * - GetAnimationDistance(CPASAnimParmData{pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)}); + GetAnimationDistance( + CPASAnimParmData{pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)}); if (x568_data.xd8_particleGen1.IsValid() && x568_data.xdc_particleGen2.IsValid() && x568_data.xe0_particleGen3.IsValid()) { x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xd8_particleGen1})); @@ -747,7 +748,8 @@ void CFlyingPirate::FireProjectile(CStateManager& mgr, float dt) { } if (projectileFired) { const std::pair anim = x450_bodyController->GetPASDatabase().FindBestAnimation( - CPASAnimParmData{pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); + CPASAnimParmData{pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), + -1); if (anim.first > 0.f) { GetModelData()->GetAnimationData()->AddAdditiveAnimation(anim.second, 1.f, false, true); } @@ -1328,7 +1330,7 @@ void CFlyingPirate::UpdateLandingSmoke(CStateManager& mgr, bool active) { particleLevel = cover->GetTranslation().z() - 1.f; } const CRayCastResult result = mgr.RayStaticIntersection(origin, zeus::skDown, origin.z() - particleLevel, - CMaterialFilter::MakeInclude({EMaterialTypes::Solid})); + CMaterialFilter::MakeInclude({EMaterialTypes::Solid})); int idx = 1; if (result.IsValid()) { const CMaterialList& list = result.GetMaterial(); diff --git a/Runtime/MP1/World/CIceAttackProjectile.cpp b/Runtime/MP1/World/CIceAttackProjectile.cpp index 33d87fb7a..68fa87c4a 100644 --- a/Runtime/MP1/World/CIceAttackProjectile.cpp +++ b/Runtime/MP1/World/CIceAttackProjectile.cpp @@ -36,17 +36,14 @@ CIceAttackProjectile::CIceAttackProjectile(const TToken& gen1, CElementGen::EOptionalSystemFlags::One); } -void CIceAttackProjectile::Accept(IVisitor& visitor) { - visitor.Visit(this); -} +void CIceAttackProjectile::Accept(IVisitor& visitor) { visitor.Visit(this); } void CIceAttackProjectile::Think(float dt, CStateManager& mgr) { if (!GetActive()) { return; } - if (!x190_) { - } + if (!x190_) {} CEntity::Think(dt, mgr); } diff --git a/Runtime/MP1/World/CIceSheegoth.hpp b/Runtime/MP1/World/CIceSheegoth.hpp index d2572e5f8..d34b5eb03 100644 --- a/Runtime/MP1/World/CIceSheegoth.hpp +++ b/Runtime/MP1/World/CIceSheegoth.hpp @@ -186,8 +186,7 @@ class CIceSheegoth : public CPatterned { void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos); zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const; bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const; - bool IsClosestSheegoth(CStateManager& mgr, const EntityList& nearList, - const zeus::CVector3f& projectileOffset) const; + bool IsClosestSheegoth(CStateManager& mgr, const EntityList& nearList, const zeus::CVector3f& projectileOffset) const; public: DEFINE_PATTERNED(IceSheeegoth); diff --git a/Runtime/MP1/World/CJellyZap.hpp b/Runtime/MP1/World/CJellyZap.hpp index 3799e945b..0b89431d5 100644 --- a/Runtime/MP1/World/CJellyZap.hpp +++ b/Runtime/MP1/World/CJellyZap.hpp @@ -34,9 +34,9 @@ public: DEFINE_PATTERNED(JellyZap); CJellyZap(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, - CModelData&& mData, const CDamageInfo& attackDamage, bool b1, float attackRadius, float f2, float f3, float f4, float attackDelay, - float f6, float f7, float f8, float priority, float repulseRadius, float attractRadius, float f12, - const CPatternedInfo& pInfo, const CActorParameters& actParms); + CModelData&& mData, const CDamageInfo& attackDamage, bool b1, float attackRadius, float f2, float f3, + float f4, float attackDelay, float f6, float f7, float f8, float priority, float repulseRadius, + float attractRadius, float f12, const CPatternedInfo& pInfo, const CActorParameters& actParms); void Accept(IVisitor&) override; void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; diff --git a/Runtime/MP1/World/CMakeLists.txt b/Runtime/MP1/World/CMakeLists.txt index 0417d8109..63449e161 100644 --- a/Runtime/MP1/World/CMakeLists.txt +++ b/Runtime/MP1/World/CMakeLists.txt @@ -1,58 +1,58 @@ set(MP1_WORLD_SOURCES - CActorContraption.hpp CActorContraption.cpp - CAtomicAlpha.hpp CAtomicAlpha.cpp - CAtomicBeta.hpp CAtomicBeta.cpp - CBabygoth.hpp CBabygoth.cpp - CBeetle.hpp CBeetle.cpp - CBloodFlower.hpp CBloodFlower.cpp - CBouncyGrenade.hpp CBouncyGrenade.cpp - CBurrower.hpp CBurrower.cpp - CChozoGhost.hpp CChozoGhost.cpp - CElitePirate.hpp CElitePirate.cpp - CDrone.hpp CDrone.cpp - CDroneLaser.hpp CDroneLaser.cpp - CSpacePirate.hpp CSpacePirate.cpp - CParasite.hpp CParasite.cpp - CBabygoth.hpp CBabygoth.cpp - CTryclops.hpp CTryclops.cpp - CEnergyBall.hpp CEnergyBall.cpp - CEyeball.hpp CEyeball.cpp - CFireFlea.hpp CFireFlea.cpp - CFlaahgra.hpp CFlaahgra.cpp - CFlaahgraProjectile.hpp CFlaahgraProjectile.cpp - CFlaahgraTentacle.hpp CFlaahgraTentacle.cpp - CFlickerBat.hpp CFlickerBat.cpp - CFlyingPirate.hpp CFlyingPirate.cpp - CGrenadeLauncher.hpp CGrenadeLauncher.cpp - CJellyZap.hpp CJellyZap.cpp - CMagdolite.hpp CMagdolite.cpp - CMetaree.hpp CMetaree.cpp - CMetroid.hpp CMetroid.cpp - CMetroidBeta.hpp CMetroidBeta.cpp - CMetroidPrimeExo.hpp CMetroidPrimeExo.cpp - CMetroidPrimeProjectile.hpp CMetroidPrimeProjectile.cpp - CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp - CMetroidPrimeEssence.hpp CMetroidPrimeEssence.cpp - CNewIntroBoss.hpp CNewIntroBoss.cpp - COmegaPirate.hpp COmegaPirate.cpp - CParasite.hpp CParasite.cpp - CPhazonHealingNodule.hpp CPhazonHealingNodule.cpp - CPhazonPool.hpp CPhazonPool.cpp - CPuddleSpore.hpp CPuddleSpore.cpp - CPuddleToadGamma.hpp CPuddleToadGamma.cpp - CPuffer.hpp CPuffer.cpp - CRidley.hpp CRidley.cpp - CRipper.hpp CRipper.cpp - CSeedling.hpp CSeedling.cpp - CShockWave.hpp CShockWave.cpp - CSpacePirate.hpp CSpacePirate.cpp - CSpankWeed.hpp CSpankWeed.cpp - CThardus.hpp CThardus.cpp - CThardusRockProjectile.hpp CThardusRockProjectile.cpp - CTryclops.hpp CTryclops.cpp - CIceSheegoth.hpp CIceSheegoth.cpp - CWarWasp.hpp CWarWasp.cpp - CIceAttackProjectile.hpp CIceAttackProjectile.cpp -) + CActorContraption.hpp CActorContraption.cpp + CAtomicAlpha.hpp CAtomicAlpha.cpp + CAtomicBeta.hpp CAtomicBeta.cpp + CBabygoth.hpp CBabygoth.cpp + CBeetle.hpp CBeetle.cpp + CBloodFlower.hpp CBloodFlower.cpp + CBouncyGrenade.hpp CBouncyGrenade.cpp + CBurrower.hpp CBurrower.cpp + CChozoGhost.hpp CChozoGhost.cpp + CElitePirate.hpp CElitePirate.cpp + CDrone.hpp CDrone.cpp + CDroneLaser.hpp CDroneLaser.cpp + CSpacePirate.hpp CSpacePirate.cpp + CParasite.hpp CParasite.cpp + CBabygoth.hpp CBabygoth.cpp + CTryclops.hpp CTryclops.cpp + CEnergyBall.hpp CEnergyBall.cpp + CEyeball.hpp CEyeball.cpp + CFireFlea.hpp CFireFlea.cpp + CFlaahgra.hpp CFlaahgra.cpp + CFlaahgraProjectile.hpp CFlaahgraProjectile.cpp + CFlaahgraTentacle.hpp CFlaahgraTentacle.cpp + CFlickerBat.hpp CFlickerBat.cpp + CFlyingPirate.hpp CFlyingPirate.cpp + CGrenadeLauncher.hpp CGrenadeLauncher.cpp + CJellyZap.hpp CJellyZap.cpp + CMagdolite.hpp CMagdolite.cpp + CMetaree.hpp CMetaree.cpp + CMetroid.hpp CMetroid.cpp + CMetroidBeta.hpp CMetroidBeta.cpp + CMetroidPrimeExo.hpp CMetroidPrimeExo.cpp + CMetroidPrimeProjectile.hpp CMetroidPrimeProjectile.cpp + CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp + CMetroidPrimeEssence.hpp CMetroidPrimeEssence.cpp + CNewIntroBoss.hpp CNewIntroBoss.cpp + COmegaPirate.hpp COmegaPirate.cpp + CParasite.hpp CParasite.cpp + CPhazonHealingNodule.hpp CPhazonHealingNodule.cpp + CPhazonPool.hpp CPhazonPool.cpp + CPuddleSpore.hpp CPuddleSpore.cpp + CPuddleToadGamma.hpp CPuddleToadGamma.cpp + CPuffer.hpp CPuffer.cpp + CRidley.hpp CRidley.cpp + CRipper.hpp CRipper.cpp + CSeedling.hpp CSeedling.cpp + CShockWave.hpp CShockWave.cpp + CSpacePirate.hpp CSpacePirate.cpp + CSpankWeed.hpp CSpankWeed.cpp + CThardus.hpp CThardus.cpp + CThardusRockProjectile.hpp CThardusRockProjectile.cpp + CTryclops.hpp CTryclops.cpp + CIceSheegoth.hpp CIceSheegoth.cpp + CWarWasp.hpp CWarWasp.cpp + CIceAttackProjectile.hpp CIceAttackProjectile.cpp + ) runtime_add_list(World MP1_WORLD_SOURCES) diff --git a/Runtime/MP1/World/CMetroidBeta.cpp b/Runtime/MP1/World/CMetroidBeta.cpp index 86035acd7..2a6425daa 100644 --- a/Runtime/MP1/World/CMetroidBeta.cpp +++ b/Runtime/MP1/World/CMetroidBeta.cpp @@ -86,7 +86,7 @@ void CMetroidBeta::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta case EScriptObjectMessage::Registered: { x450_bodyController->Activate(mgr); CreateCollisionActorManager(mgr); - //sub801c13d4(); + // sub801c13d4(); x760_ = GetModelData()->GetAnimationData()->GetLocatorSegId("L_Claw_1"sv); x761_ = GetModelData()->GetAnimationData()->GetLocatorSegId("R_Claw_1"sv); break; @@ -140,7 +140,7 @@ void CMetroidBeta::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta case EScriptObjectMessage::Touched: { if (TCastToConstPtr colAct = mgr.GetObjectById(uid)) { if (HealthInfo(mgr)->GetHP() > 0.f && colAct->GetLastTouchedObject() == mgr.GetPlayer().GetUniqueId() && - x420_curDamageRemTime <= 0.f) { + x420_curDamageRemTime <= 0.f) { CDamageInfo dInfo = GetContactDamage(); dInfo.SetDamage(0.5f * dInfo.GetDamage()); if (x840_29_ && x840_30_) @@ -219,9 +219,7 @@ void CMetroidBeta::TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) { CPatterned::TargetPatrol(mgr, msg, arg); } -void CMetroidBeta::Generate(CStateManager& mgr, EStateMsg msg, float arg) { - CAi::Generate(mgr, msg, arg); -} +void CMetroidBeta::Generate(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Generate(mgr, msg, arg); } void CMetroidBeta::Attack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Attack(mgr, msg, arg); } @@ -267,7 +265,7 @@ void CMetroidBeta::RenderHitGunEffect() const {} void CMetroidBeta::RenderHitBallEffect() const {} -static SSphereJointInfo skPelvisInfo[1] { +static SSphereJointInfo skPelvisInfo[1]{ {"Pelvis", 1.5f}, }; @@ -296,7 +294,7 @@ void CMetroidBeta::CreateCollisionActorManager(CStateManager& mgr) { } void CMetroidBeta::AddSphereJoints(SSphereJointInfo* sphereJoints, s32 count, - std::vector& joints) { + std::vector& joints) { for (s32 i = 0; i < count; ++i) { const auto& sphereJoint = sphereJoints[i]; diff --git a/Runtime/MP1/World/CMetroidPrimeEssence.cpp b/Runtime/MP1/World/CMetroidPrimeEssence.cpp index 9c5a45641..e59686c8f 100644 --- a/Runtime/MP1/World/CMetroidPrimeEssence.cpp +++ b/Runtime/MP1/World/CMetroidPrimeEssence.cpp @@ -28,10 +28,12 @@ std::array skUnkInts1{{0, 1, 0, 2}}; std::array skUnkInts2{{1, 2, 3}}; } // namespace -CMetroidPrimeEssence::CMetroidPrimeEssence(metaforce::TUniqueId uid, std::string_view name, const metaforce::CEntityInfo& info, - const zeus::CTransform& xf, - metaforce::CModelData&& mData, - const metaforce::CPatternedInfo& pInfo, const metaforce::CActorParameters& actParms, metaforce::CAssetId particle1, const metaforce::CDamageInfo& dInfo, float f1, metaforce::CAssetId electric, u32 w1, metaforce::CAssetId particle2) +CMetroidPrimeEssence::CMetroidPrimeEssence(metaforce::TUniqueId uid, std::string_view name, + const metaforce::CEntityInfo& info, const zeus::CTransform& xf, + metaforce::CModelData&& mData, const metaforce::CPatternedInfo& pInfo, + const metaforce::CActorParameters& actParms, metaforce::CAssetId particle1, + const metaforce::CDamageInfo& dInfo, float f1, metaforce::CAssetId electric, + u32 w1, metaforce::CAssetId particle2) : CPatterned(ECharacter::MetroidPrimeEssence, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, EMovementType::Flyer, EColliderType::One, EBodyType::Flyer, actParms, EKnockBackVariant::Medium) , x568_(g_SimplePool->GetObj({FOURCC('PART'), particle2})) diff --git a/Runtime/MP1/World/CMetroidPrimeEssence.hpp b/Runtime/MP1/World/CMetroidPrimeEssence.hpp index 1846baed6..283a74445 100644 --- a/Runtime/MP1/World/CMetroidPrimeEssence.hpp +++ b/Runtime/MP1/World/CMetroidPrimeEssence.hpp @@ -55,7 +55,7 @@ class CMetroidPrimeEssence : public CPatterned { void sub8027cee0(CStateManager& mgr); u32 sub8027cfd4(CStateManager& mgr, bool w1); void DoPhaseTransition(CStateManager& mgr); - u32 sub8027d428() { return 2; /* Decided by fair dice roll, guaranteed to be random */} + u32 sub8027d428() { return 2; /* Decided by fair dice roll, guaranteed to be random */ } void ShakeCamera(CStateManager& mgr, float f1); void DropShockwave(CStateManager& mgr, const SShockWaveData& shockWaveData); CRayCastResult RayStaticIntersection(CStateManager& mgr); diff --git a/Runtime/MP1/World/CMetroidPrimeExo.hpp b/Runtime/MP1/World/CMetroidPrimeExo.hpp index 8e8bf0816..189ade119 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.hpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.hpp @@ -138,8 +138,8 @@ class CMetroidPrimeExo : public CPatterned { SPrimeStruct2B x930_; rstl::reserved_vector x96c_; rstl::reserved_vector xa80_; - rstl::reserved_vector xb24_plasmaProjectileIds = {{kInvalidUniqueId, kInvalidUniqueId, kInvalidUniqueId, - kInvalidUniqueId}}; + rstl::reserved_vector xb24_plasmaProjectileIds = { + {kInvalidUniqueId, kInvalidUniqueId, kInvalidUniqueId, kInvalidUniqueId}}; rstl::reserved_vector xb30_; rstl::reserved_vector xbc4_; TLockedToken xc48_; diff --git a/Runtime/MP1/World/CMetroidPrimeProjectile.cpp b/Runtime/MP1/World/CMetroidPrimeProjectile.cpp index b56b574d8..6c7b1bf8d 100644 --- a/Runtime/MP1/World/CMetroidPrimeProjectile.cpp +++ b/Runtime/MP1/World/CMetroidPrimeProjectile.cpp @@ -19,12 +19,13 @@ SPrimeProjectileInfo::SPrimeProjectileInfo(CInputStream& in) x38_27_ = in.readBool(); } -CMetroidPrimeProjectile::CMetroidPrimeProjectile( - bool active, const TToken& desc, EWeaponType type, const zeus::CTransform& xf, - EMaterialTypes materials, const CDamageInfo& damage, TUniqueId uid, TAreaId aid, TUniqueId owner, - const SPrimeProjectileInfo& auxData, TUniqueId homingTarget, EProjectileAttrib attribs, - const zeus::CVector3f& scale, const std::optional>& visorParticle, - u16 visorSfx, bool sendCollideMsg) +CMetroidPrimeProjectile::CMetroidPrimeProjectile(bool active, const TToken& desc, EWeaponType type, + const zeus::CTransform& xf, EMaterialTypes materials, + const CDamageInfo& damage, TUniqueId uid, TAreaId aid, TUniqueId owner, + const SPrimeProjectileInfo& auxData, TUniqueId homingTarget, + EProjectileAttrib attribs, const zeus::CVector3f& scale, + const std::optional>& visorParticle, + u16 visorSfx, bool sendCollideMsg) : CEnergyProjectile(active, desc, type, xf, materials, damage, uid, aid, owner, homingTarget, attribs, false, scale, visorParticle, visorSfx, sendCollideMsg) , x3d8_auxData(auxData) {} diff --git a/Runtime/MP1/World/CMetroidPrimeRelay.cpp b/Runtime/MP1/World/CMetroidPrimeRelay.cpp index 24a8339d3..43f7d934a 100644 --- a/Runtime/MP1/World/CMetroidPrimeRelay.cpp +++ b/Runtime/MP1/World/CMetroidPrimeRelay.cpp @@ -59,12 +59,13 @@ void CMetroidPrimeRelay::GetOrBuildMetroidPrimeExo(CStateManager& mgr) { CModelData mData( CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), x68_scale, animParms.GetInitialAnimation(), true)); auto* exo = new CMetroidPrimeExo( - mgr.AllocateUniqueId(), "Metroid Prime! (Stage 1)"sv, CEntityInfo(GetAreaId(), NullConnectionList), x38_xf, std::move(mData), - x74_parms.x4_patternedInfo, x74_parms.x13c_actorParms, x74_parms.x1a4_, x74_parms.x1a8_, x74_parms.x27c_, - x74_parms.x350_, x74_parms.x424_, x74_parms.x460_particle1, x74_parms.x464_, x74_parms.x708_wpsc1, - x74_parms.x70c_dInfo1, x74_parms.x728_shakeData1, x74_parms.x7fc_wpsc2, x74_parms.x800_dInfo2, - x74_parms.x81c_shakeData2, x74_parms.x8f0_, x74_parms.x92c_, x74_parms.x948_, x74_parms.xa1c_particle2, - x74_parms.xa20_swoosh, x74_parms.xa24_particle3, x74_parms.xa28_particle4, x74_parms.xa2c_); + mgr.AllocateUniqueId(), "Metroid Prime! (Stage 1)"sv, CEntityInfo(GetAreaId(), NullConnectionList), x38_xf, + std::move(mData), x74_parms.x4_patternedInfo, x74_parms.x13c_actorParms, x74_parms.x1a4_, x74_parms.x1a8_, + x74_parms.x27c_, x74_parms.x350_, x74_parms.x424_, x74_parms.x460_particle1, x74_parms.x464_, + x74_parms.x708_wpsc1, x74_parms.x70c_dInfo1, x74_parms.x728_shakeData1, x74_parms.x7fc_wpsc2, + x74_parms.x800_dInfo2, x74_parms.x81c_shakeData2, x74_parms.x8f0_, x74_parms.x92c_, x74_parms.x948_, + x74_parms.xa1c_particle2, x74_parms.xa20_swoosh, x74_parms.xa24_particle3, x74_parms.xa28_particle4, + x74_parms.xa2c_); mgr.AddObject(exo); mgr.SendScriptMsg(exo, kInvalidUniqueId, EScriptObjectMessage::InitializedInArea); } diff --git a/Runtime/MP1/World/CMetroidPrimeRelay.hpp b/Runtime/MP1/World/CMetroidPrimeRelay.hpp index 2c97e70e8..dd059b927 100644 --- a/Runtime/MP1/World/CMetroidPrimeRelay.hpp +++ b/Runtime/MP1/World/CMetroidPrimeRelay.hpp @@ -30,6 +30,7 @@ class CMetroidPrimeRelay : public CEntity { void ForwardMessageToMetroidPrimeExo(EScriptObjectMessage msg, CStateManager& mgr); void GetOrBuildMetroidPrimeExo(CStateManager& mgr); + public: DEFINE_ENTITY CMetroidPrimeRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active, @@ -37,7 +38,7 @@ public: float f2, float f3, u32 w1, bool b1, u32 w2, const CHealthInfo& hInfo1, const CHealthInfo& hInfo2, u32 w3, u32 w4, u32 w5, rstl::reserved_vector&& roomParms); void Accept(IVisitor& visitor) override; - void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr) override; + void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) override; [[nodiscard]] TUniqueId GetMetroidPrimeExoId() const { return x34_mpUid; } void SetMetroidPrimeExoId(TUniqueId uid) { x34_mpUid = uid; } float Get_xc84() const { return xc84_f1; } @@ -52,7 +53,6 @@ public: u32 Get_xcb0() const { return xcb0_w4; } u32 Get_xcb4() const { return xcb4_w5; } rstl::reserved_vector GetRoomParameters() const { return xcb8_roomParms; } - }; } // namespace metaforce::MP1 diff --git a/Runtime/MP1/World/COmegaPirate.cpp b/Runtime/MP1/World/COmegaPirate.cpp index d21316245..de3e47acc 100644 --- a/Runtime/MP1/World/COmegaPirate.cpp +++ b/Runtime/MP1/World/COmegaPirate.cpp @@ -598,9 +598,7 @@ void COmegaPirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) { } } -bool COmegaPirate::Landed(CStateManager& mgr, float arg) { - return xb4c_armorPiecesHealed == 4; -} +bool COmegaPirate::Landed(CStateManager& mgr, float arg) { return xb4c_armorPiecesHealed == 4; } zeus::CVector3f COmegaPirate::GetOrbitPosition(const CStateManager& mgr) const { if (x990_launcherId2 != kInvalidUniqueId && @@ -720,7 +718,9 @@ bool COmegaPirate::ShouldFire(CStateManager& mgr, float arg) { return false; } -bool COmegaPirate::ShouldMove(CStateManager& mgr, float arg) { return xb64_stateTime < x330_stateMachineState.GetTime(); } +bool COmegaPirate::ShouldMove(CStateManager& mgr, float arg) { + return xb64_stateTime < x330_stateMachineState.GetTime(); +} void COmegaPirate::Shuffle(CStateManager& mgr, EStateMsg msg, float dt) {} diff --git a/Runtime/MP1/World/CParasite.cpp b/Runtime/MP1/World/CParasite.cpp index 2141b2fdf..2d025691b 100644 --- a/Runtime/MP1/World/CParasite.cpp +++ b/Runtime/MP1/World/CParasite.cpp @@ -430,9 +430,8 @@ void CParasite::DoFlockingBehavior(CStateManager& mgr) { } if (x628_parasiteSeparationMove != zeus::skZero3f) { - x450_bodyController->GetCommandMgr().DeliverCmd( - CBCLocomotionCmd(ProjectVectorToPlane(x628_parasiteSeparationMove, upVec), zeus::skZero3f, - x6ec_parasiteSeparationWeight)); + x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( + ProjectVectorToPlane(x628_parasiteSeparationMove, upVec), zeus::skZero3f, x6ec_parasiteSeparationWeight)); } for (const auto& r : x5d8_doorRepulsors) { @@ -447,9 +446,8 @@ void CParasite::DoFlockingBehavior(CStateManager& mgr) { if (x608_telegraphRemTime <= 0.f) { x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( ProjectVectorToPlane(x634_parasiteCohesionMove, upVec), zeus::skZero3f, x6f4_parasiteCohesionWeight)); - x450_bodyController->GetCommandMgr().DeliverCmd( - CBCLocomotionCmd(ProjectVectorToPlane(x640_parasiteAlignmentMove, upVec), zeus::skZero3f, - x6f0_parasiteAlignmentWeight)); + x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( + ProjectVectorToPlane(x640_parasiteAlignmentMove, upVec), zeus::skZero3f, x6f0_parasiteAlignmentWeight)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( ProjectVectorToPlane( ProjectVectorToPlane(x45c_steeringBehaviors.Seek(*this, x2e0_destPos), upVec) * x604_activeSpeed, upVec), @@ -559,8 +557,7 @@ void CParasite::Halt(CStateManager& mgr, EStateMsg msg, float) { x743_24_halted = true; x5d6_24_alignToFloor = true; if (x5d0_walkerType == EWalkerType::Geemer) - CSfxManager::AddEmitter(x73c_haltSfx, GetTranslation(), zeus::skZero3f, true, false, 0x7f, - kInvalidAreaId); + CSfxManager::AddEmitter(x73c_haltSfx, GetTranslation(), zeus::skZero3f, true, false, 0x7f, kInvalidAreaId); break; case EStateMsg::Update: TryCommand(mgr, pas::EAnimationState::LoopReaction, &CPatterned::TryLoopReaction, 1); @@ -678,8 +675,7 @@ void CParasite::Crouch(CStateManager&, EStateMsg msg, float) { if (msg == EStateMsg::Activate) { x450_bodyController->SetLocomotionType(pas::ELocomotionType::Crouch); if (x5d0_walkerType == EWalkerType::Geemer) - CSfxManager::AddEmitter(x740_crouchSfx, GetTranslation(), zeus::skZero3f, true, false, 0x7f, - kInvalidAreaId); + CSfxManager::AddEmitter(x740_crouchSfx, GetTranslation(), zeus::skZero3f, true, false, 0x7f, kInvalidAreaId); } } @@ -687,8 +683,7 @@ void CParasite::GetUp(CStateManager&, EStateMsg msg, float) { if (msg == EStateMsg::Activate) { x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed); if (x5d0_walkerType == EWalkerType::Geemer) - CSfxManager::AddEmitter(x73e_getUpSfx, GetTranslation(), zeus::skZero3f, true, false, 0x7f, - kInvalidAreaId); + CSfxManager::AddEmitter(x73e_getUpSfx, GetTranslation(), zeus::skZero3f, true, false, 0x7f, kInvalidAreaId); } } @@ -741,8 +736,8 @@ void CParasite::Jump(CStateManager& mgr, EStateMsg msg, float) { } void CParasite::FaceTarget(const zeus::CVector3f& target) { - zeus::CQuaternion q = zeus::CQuaternion::lookAt(zeus::CTransform().basis[1], target - GetTranslation(), - zeus::degToRad(360.f)); + zeus::CQuaternion q = + zeus::CQuaternion::lookAt(zeus::CTransform().basis[1], target - GetTranslation(), zeus::degToRad(360.f)); SetTransform(q.toTransform(GetTranslation())); } diff --git a/Runtime/MP1/World/CPhazonHealingNodule.hpp b/Runtime/MP1/World/CPhazonHealingNodule.hpp index e9b5f1f0b..4b97ad2d5 100644 --- a/Runtime/MP1/World/CPhazonHealingNodule.hpp +++ b/Runtime/MP1/World/CPhazonHealingNodule.hpp @@ -36,13 +36,13 @@ public: void Lurk(CStateManager& mgr, EStateMsg msg, float dt) override; void Patrol(CStateManager& mgr, EStateMsg msg, float dt) override; - bool InRange(CStateManager &, float arg) override; - bool InDetectionRange(CStateManager &, float arg) override; - bool AnimOver(CStateManager &, float arg) override; + bool InRange(CStateManager&, float arg) override; + bool InDetectionRange(CStateManager&, float arg) override; + bool AnimOver(CStateManager&, float arg) override; - void MassiveDeath(CStateManager &mgr) override; - void MassiveFrozenDeath(CStateManager &mgr) override; - void PhazeOut(CStateManager &) override; + void MassiveDeath(CStateManager& mgr) override; + void MassiveFrozenDeath(CStateManager& mgr) override; + void PhazeOut(CStateManager&) override; private: void UpdateParticleElectric(CStateManager& mgr); diff --git a/Runtime/MP1/World/CPuddleToadGamma.cpp b/Runtime/MP1/World/CPuddleToadGamma.cpp index ca9f7949d..7ee32396c 100644 --- a/Runtime/MP1/World/CPuddleToadGamma.cpp +++ b/Runtime/MP1/World/CPuddleToadGamma.cpp @@ -142,7 +142,7 @@ void CPuddleToadGamma::ShootPlayer(CStateManager& mgr, float speed) { mgr.GetPlayer().ApplyImpulseWR(mgr.GetPlayer().GetMass() * shootDir * speed, {}); mgr.GetPlayer().SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr); mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x570_playerShootDamage, - CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); + CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); mgr.GetPlayer().GetMorphBall()->SetAsProjectile(); EntityList nearList; mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Bomb}), this); @@ -175,7 +175,7 @@ bool CPuddleToadGamma::PlayerInVortexArea(const CStateManager& mgr) const { if (playerDist > 2.f) { const CRayCastResult result = mgr.RayStaticIntersection(suckPointToPlayer, 1.f / playerDist * suckPointToPlayer, - playerDist - player.GetMorphBall()->GetBallRadius(), skSolidFilter); + playerDist - player.GetMorphBall()->GetBallRadius(), skSolidFilter); if (result.IsValid()) return false; } diff --git a/Runtime/MP1/World/CRidley.cpp b/Runtime/MP1/World/CRidley.cpp index e8550bdc8..207c571e3 100644 --- a/Runtime/MP1/World/CRidley.cpp +++ b/Runtime/MP1/World/CRidley.cpp @@ -433,10 +433,10 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan xb24_ = 0.33f; x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f); if (xb10_ > 0.f) { - if (xb10_ >= xcbc_&& xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) { - dontKnockback = true; - x450_bodyController->GetCommandMgr().DeliverCmd( - CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero)); + if (xb10_ >= xcbc_ && xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) { + dontKnockback = true; + x450_bodyController->GetCommandMgr().DeliverCmd( + CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero)); } else { xa32_27_ = true; dontKnockback = true; diff --git a/Runtime/MP1/World/CRipper.hpp b/Runtime/MP1/World/CRipper.hpp index 4e0430abe..ea8ada4e5 100644 --- a/Runtime/MP1/World/CRipper.hpp +++ b/Runtime/MP1/World/CRipper.hpp @@ -48,6 +48,6 @@ public: CRipperControlledPlatform(TUniqueId, TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const zeus::CAABox&, bool, const std::optional>&); - zeus::CQuaternion Move(float, CStateManager &) override; + zeus::CQuaternion Move(float, CStateManager&) override; }; } // namespace metaforce::MP1 diff --git a/Runtime/MP1/World/CSpacePirate.hpp b/Runtime/MP1/World/CSpacePirate.hpp index bdb8f1b7a..fbb64b249 100644 --- a/Runtime/MP1/World/CSpacePirate.hpp +++ b/Runtime/MP1/World/CSpacePirate.hpp @@ -41,6 +41,7 @@ class CSpacePirate : public CPatterned { public: DEFINE_PATTERNED(SpacePirate); + private: class CSpacePirateData { friend class CSpacePirate; @@ -223,8 +224,8 @@ private: void SetVelocityForJump(); void AvoidActors(CStateManager& mgr); void UpdateCantSeePlayer(CStateManager& mgr); - [[nodiscard]] bool LineOfSightTest(const CStateManager& mgr, const zeus::CVector3f& eyePos, const zeus::CVector3f& targetPos, - const CMaterialList& excludeList) const; + [[nodiscard]] bool LineOfSightTest(const CStateManager& mgr, const zeus::CVector3f& eyePos, + const zeus::CVector3f& targetPos, const CMaterialList& excludeList) const; void UpdateHeldPosition(CStateManager& mgr, float dt); void CheckBlade(CStateManager& mgr); [[nodiscard]] bool CantJumpBack(const CStateManager& mgr, const zeus::CVector3f& dir, float dist) const; @@ -251,7 +252,7 @@ public: [[nodiscard]] bool IsListening() const override; bool Listen(const zeus::CVector3f&, EListenNoiseType) override; [[nodiscard]] zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role, - const zeus::CVector3f& aimPos) const override; + const zeus::CVector3f& aimPos) const override; void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; } bool AttachActorToPirate(TUniqueId id); void SetAttackTarget(TUniqueId id); diff --git a/Runtime/MP1/World/CSpankWeed.cpp b/Runtime/MP1/World/CSpankWeed.cpp index 3ecc6c777..c3bbef917 100644 --- a/Runtime/MP1/World/CSpankWeed.cpp +++ b/Runtime/MP1/World/CSpankWeed.cpp @@ -43,7 +43,7 @@ CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo& GetModelData()->SetScale(zeus::CVector3f(scale)); SpankLog.report(logvisor::Level::Warning, FMT_STRING("WARNING: Non-uniform scale {} applied to Spank Weed" - "...changing scale to ({} {} {})\n"), + "...changing scale to ({} {} {})\n"), modelScale, scale, scale, scale); } CMaterialList list = GetMaterialFilter().GetExcludeList(); diff --git a/Runtime/MP1/World/CThardus.hpp b/Runtime/MP1/World/CThardus.hpp index c8488f6bf..363492734 100644 --- a/Runtime/MP1/World/CThardus.hpp +++ b/Runtime/MP1/World/CThardus.hpp @@ -184,7 +184,6 @@ class CThardus : public CPatterned { void DoFlinch(CStateManager& mgr) { x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "Flinch"sv); } void _DoSuckState(CStateManager& mgr) { x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "Suck"sv); } - zeus::CVector2f GetSteeringVector(CStateManager& mgr) const; void UpdateHealthInfo(CStateManager& mgr); void BouncePlayer(float f1, CStateManager& mgr); diff --git a/Runtime/MP1/World/CThardusRockProjectile.hpp b/Runtime/MP1/World/CThardusRockProjectile.hpp index 8f3b0cd8b..e853f9f31 100644 --- a/Runtime/MP1/World/CThardusRockProjectile.hpp +++ b/Runtime/MP1/World/CThardusRockProjectile.hpp @@ -32,15 +32,18 @@ class CThardusRockProjectile : public CPatterned { bool x5dc_ = false; bool x5dd_ = false; bool x5de_; - void DoExplosion(CStateManager& mgr, CAssetId particleId, const zeus::CVector3f& pos, const zeus::CVector3f& scale, u32 w2); + void DoExplosion(CStateManager& mgr, CAssetId particleId, const zeus::CVector3f& pos, const zeus::CVector3f& scale, + u32 w2); void ExplodeAndShake(CStateManager& mgr, const zeus::CVector3f& pos); void ModifyActorMaterial(CStateManager& mgr, bool remove, EMaterialTypes mat); void SetChildrenActive(CStateManager& mgr, bool active); void InitializeCollisionManager(CStateManager& mgr); - void AddSphereCollisionList(const SSphereJointInfo* info, size_t count, std::vector& vecOut); + void AddSphereCollisionList(const SSphereJointInfo* info, size_t count, + std::vector& vecOut); void SetMaterialProperties(const std::unique_ptr& colMgr, CStateManager& mgr); void UpdateDestroyableRockPositions(CStateManager& mgr); void UpdateDestroyableRockCollisionActors(CStateManager& mgr); + public: DEFINE_PATTERNED(ThardusRockProjectile); CThardusRockProjectile(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, diff --git a/Runtime/MP1/World/CWarWasp.cpp b/Runtime/MP1/World/CWarWasp.cpp index e34270e74..7928a83cb 100644 --- a/Runtime/MP1/World/CWarWasp.cpp +++ b/Runtime/MP1/World/CWarWasp.cpp @@ -43,8 +43,8 @@ void CWarWasp::Accept(IVisitor& visitor) { visitor.Visit(this); } void CWarWasp::SwarmAdd(CStateManager& mgr) { if (x674_aiMgr != kInvalidUniqueId) { if (TCastToPtr aimgr = mgr.ObjectById(x674_aiMgr)) { - CTeamAiRole::ETeamAiRole role = x3fc_flavor == EFlavorType::Two ? - CTeamAiRole::ETeamAiRole::Ranged : CTeamAiRole::ETeamAiRole::Melee; + CTeamAiRole::ETeamAiRole role = + x3fc_flavor == EFlavorType::Two ? CTeamAiRole::ETeamAiRole::Ranged : CTeamAiRole::ETeamAiRole::Melee; if (!aimgr->IsPartOfTeam(GetUniqueId())) { aimgr->AssignTeamAiRole(*this, role, CTeamAiRole::ETeamAiRole::Invalid, CTeamAiRole::ETeamAiRole::Invalid); } @@ -123,9 +123,7 @@ void CWarWasp::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStat } } -std::optional CWarWasp::GetTouchBounds() const { - return {x570_cSphere.CalculateAABox(GetTransform())}; -} +std::optional CWarWasp::GetTouchBounds() const { return {x570_cSphere.CalculateAABox(GetTransform())}; } zeus::CVector3f CWarWasp::GetProjectileAimPos(const CStateManager& mgr, float zBias) const { zeus::CVector3f ret = mgr.GetPlayer().GetAimPosition(mgr, 0.f); @@ -326,8 +324,7 @@ void CWarWasp::ApplyNormalSteering(CStateManager& mgr) { break; case 2: if (ShouldTurn(mgr, 30.f) && delta.canBeNormalized()) { - x450_bodyController->GetCommandMgr().DeliverCmd( - CBCLocomotionCmd(zeus::skZero3f, delta.normalized(), 1.f)); + x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(zeus::skZero3f, delta.normalized(), 1.f)); } break; default: @@ -722,8 +719,7 @@ void CWarWasp::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float dt) { case EStateMsg::Activate: x72e_28_inProjectileAttack = true; if (x674_aiMgr != kInvalidUniqueId) { - x568_stateProg = CTeamAiMgr::AddAttacker(CTeamAiMgr::EAttackType::Ranged, - mgr, x674_aiMgr, GetUniqueId()) ? 0 : 3; + x568_stateProg = CTeamAiMgr::AddAttacker(CTeamAiMgr::EAttackType::Ranged, mgr, x674_aiMgr, GetUniqueId()) ? 0 : 3; } else { x568_stateProg = 0; } @@ -881,7 +877,8 @@ float CWarWasp::GetTeamZStratum(s32 team) const { float CWarWasp::CalcSeekMagnitude(const CStateManager& mgr) const { static constexpr std::array Table{0.4f, 0.6f, 1.f}; - const float ret = ((x708_circleAttackTeam >= 0 && x708_circleAttackTeam < 3) ? Table[x708_circleAttackTeam] : 1.f) * 0.9f; + const float ret = + ((x708_circleAttackTeam >= 0 && x708_circleAttackTeam < 3) ? Table[x708_circleAttackTeam] : 1.f) * 0.9f; if (TCastToConstPtr aimgr = mgr.GetObjectById(x674_aiMgr)) { if (aimgr->IsPartOfTeam(GetUniqueId())) { if (aimgr->GetMaxMeleeAttackerCount() > 1) { @@ -994,9 +991,8 @@ void CWarWasp::Retreat(CStateManager& mgr, EStateMsg msg, float dt) { x450_bodyController->SetLocomotionType(pas::ELocomotionType::Internal5); break; case EStateMsg::Update: - x450_bodyController->GetCommandMgr().DeliverCmd( - CBCLocomotionCmd(x45c_steeringBehaviors.Flee2D(*this, mgr.GetPlayer().GetTranslation().toVec2f()), - zeus::skZero3f, 1.f)); + x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( + x45c_steeringBehaviors.Flee2D(*this, mgr.GetPlayer().GetTranslation().toVec2f()), zeus::skZero3f, 1.f)); break; case EStateMsg::Deactivate: x400_24_hitByPlayerProjectile = false; diff --git a/Runtime/MkCastTo.py b/Runtime/MkCastTo.py index a53a411ec..e4cf60c98 100644 --- a/Runtime/MkCastTo.py +++ b/Runtime/MkCastTo.py @@ -1,12 +1,15 @@ "Generates TCastTo source files for constexpr-enabled CEntity casts" + class Namespace: def __init__(self, name): self.name = name + class EndNamespace: pass + CENTITY_TYPES = ( # Class, Header ('CActor', 'World/CActor.hpp'), @@ -79,12 +82,14 @@ CENTITY_TYPES = ( ('CScriptDebris', 'World/CScriptDebris.hpp'), ) + def getqualified(tp): if len(tp) >= 3: return tp[2] + '::' + tp[0] else: return tp[0] + headerf = open('TCastTo.hpp', 'w') sourcef = open('TCastTo.cpp', 'w') diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index a2fc40b69..262b16dd3 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -250,7 +250,7 @@ bool CElementGen::Update(double t) { } void CElementGen::_RecreatePipelines() { - size_t maxInsts = x26c_30_MBLR ? 2560 * 2 : 2560;//x26c_30_MBLR ? (x270_MBSP * x90_MAXP) : x90_MAXP; + size_t maxInsts = x26c_30_MBLR ? 2560 * 2 : 2560; // x26c_30_MBLR ? (x270_MBSP * x90_MAXP) : x90_MAXP; maxInsts = (maxInsts == 0 ? 256 : maxInsts); CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { @@ -359,8 +359,8 @@ void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 par CGenDescription* desc = x28_loadedGenDesc; if (activeParticleCount >= x60_advValues.size()) { - Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"), - activeParticleCount, x60_advValues.size()); + Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"), activeParticleCount, + x60_advValues.size()); } std::array& arr = x60_advValues[activeParticleCount]; diff --git a/Runtime/Particle/CElementGen.hpp b/Runtime/Particle/CElementGen.hpp index 36ca173d4..a97ff757d 100644 --- a/Runtime/Particle/CElementGen.hpp +++ b/Runtime/Particle/CElementGen.hpp @@ -135,6 +135,7 @@ private: void AccumulateBounds(const zeus::CVector3f& pos, float size); void _RecreatePipelines(); + public: explicit CElementGen(TToken gen, EModelOrientationType orientType = EModelOrientationType::Normal, EOptionalSystemFlags flags = EOptionalSystemFlags::One); @@ -226,7 +227,7 @@ public: s32 GetMaxParticles() const { return x90_MAXP; } std::vector const& GetParticles() const { return x30_particles; } - std::vector &GetParticles() { return x30_particles; } + std::vector& GetParticles() { return x30_particles; } }; ENABLE_BITWISE_ENUM(CElementGen::EOptionalSystemFlags) diff --git a/Runtime/Particle/CIntElement.cpp b/Runtime/Particle/CIntElement.cpp index 9109ab937..f061fccd9 100644 --- a/Runtime/Particle/CIntElement.cpp +++ b/Runtime/Particle/CIntElement.cpp @@ -53,9 +53,7 @@ bool CIEKeyframeEmitter::GetValue([[maybe_unused]] int frame, int& valOut) const return false; } -int CIEKeyframeEmitter::GetMaxValue() const { - return *std::max_element(x18_keys.cbegin(), x18_keys.cend()); -} +int CIEKeyframeEmitter::GetMaxValue() const { return *std::max_element(x18_keys.cbegin(), x18_keys.cend()); } bool CIEDeath::GetValue(int frame, int& valOut) const { x4_a->GetValue(frame, valOut); diff --git a/Runtime/Particle/CMakeLists.txt b/Runtime/Particle/CMakeLists.txt index f33ef908d..ba4ab8c03 100644 --- a/Runtime/Particle/CMakeLists.txt +++ b/Runtime/Particle/CMakeLists.txt @@ -1,32 +1,32 @@ set(PARTICLE_SOURCES - IElement.hpp - CGenDescription.hpp - CRealElement.hpp CRealElement.cpp - CIntElement.hpp CIntElement.cpp - CVectorElement.hpp CVectorElement.cpp - CModVectorElement.hpp CModVectorElement.cpp - CColorElement.hpp CColorElement.cpp - CUVElement.hpp CUVElement.cpp - CEmitterElement.hpp CEmitterElement.cpp - CParticleDataFactory.hpp CParticleDataFactory.cpp - CSwooshDescription.hpp - CElectricDescription.hpp - CDecalDescription.hpp - CWeaponDescription.hpp - CDecalDataFactory.hpp CDecalDataFactory.cpp - CElementGen.hpp CElementGen.cpp - CParticleSwooshDataFactory.hpp CParticleSwooshDataFactory.cpp - CParticleSwoosh.hpp CParticleSwoosh.cpp - CParticleElectricDataFactory.hpp CParticleElectricDataFactory.cpp - CParticleElectric.hpp CParticleElectric.cpp - CParticleGen.hpp CParticleGen.cpp - CProjectileWeaponDataFactory.hpp CProjectileWeaponDataFactory.cpp - CDecal.hpp CDecal.cpp - CDecalManager.hpp CDecalManager.cpp - CSpawnSystemKeyframeData.hpp CSpawnSystemKeyframeData.cpp - CWarp.hpp - CFlameWarp.hpp CFlameWarp.cpp - CParticleGlobals.hpp CParticleGlobals.cpp - ${PLAT_SRCS}) + IElement.hpp + CGenDescription.hpp + CRealElement.hpp CRealElement.cpp + CIntElement.hpp CIntElement.cpp + CVectorElement.hpp CVectorElement.cpp + CModVectorElement.hpp CModVectorElement.cpp + CColorElement.hpp CColorElement.cpp + CUVElement.hpp CUVElement.cpp + CEmitterElement.hpp CEmitterElement.cpp + CParticleDataFactory.hpp CParticleDataFactory.cpp + CSwooshDescription.hpp + CElectricDescription.hpp + CDecalDescription.hpp + CWeaponDescription.hpp + CDecalDataFactory.hpp CDecalDataFactory.cpp + CElementGen.hpp CElementGen.cpp + CParticleSwooshDataFactory.hpp CParticleSwooshDataFactory.cpp + CParticleSwoosh.hpp CParticleSwoosh.cpp + CParticleElectricDataFactory.hpp CParticleElectricDataFactory.cpp + CParticleElectric.hpp CParticleElectric.cpp + CParticleGen.hpp CParticleGen.cpp + CProjectileWeaponDataFactory.hpp CProjectileWeaponDataFactory.cpp + CDecal.hpp CDecal.cpp + CDecalManager.hpp CDecalManager.cpp + CSpawnSystemKeyframeData.hpp CSpawnSystemKeyframeData.cpp + CWarp.hpp + CFlameWarp.hpp CFlameWarp.cpp + CParticleGlobals.hpp CParticleGlobals.cpp + ${PLAT_SRCS}) runtime_add_list(Particle PARTICLE_SOURCES) diff --git a/Runtime/Particle/CParticleElectric.cpp b/Runtime/Particle/CParticleElectric.cpp index 226a40493..77d03344a 100644 --- a/Runtime/Particle/CParticleElectric.cpp +++ b/Runtime/Particle/CParticleElectric.cpp @@ -21,8 +21,7 @@ namespace metaforce { u16 CParticleElectric::g_GlobalSeed = 99; CParticleElectric::CParticleElectric(const TToken& token) -: x1c_elecDesc(token) -, x14c_randState(g_GlobalSeed++) { +: x1c_elecDesc(token), x14c_randState(g_GlobalSeed++) { x1bc_allocated.resize(32); CElectricDescription* desc = x1c_elecDesc.GetObj(); @@ -609,8 +608,8 @@ bool CParticleElectric::Update(double dt) { } void CParticleElectric::Render(const CActorLights* lights) { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CParticleElectric::Render {}"), - *x1c_elecDesc.GetObjectTag()).c_str(), zeus::skYellow); + SCOPED_GRAPHICS_DEBUG_GROUP( + fmt::format(FMT_STRING("CParticleElectric::Render {}"), *x1c_elecDesc.GetObjectTag()).c_str(), zeus::skYellow); if (!x3e8_electricManagers.empty()) { if (x450_29_transformDirty) { diff --git a/Runtime/Particle/CParticleElectricDataFactory.cpp b/Runtime/Particle/CParticleElectricDataFactory.cpp index b1e8293d6..dc6ef5f79 100644 --- a/Runtime/Particle/CParticleElectricDataFactory.cpp +++ b/Runtime/Particle/CParticleElectricDataFactory.cpp @@ -28,7 +28,6 @@ std::unique_ptr CParticleElectricDataFactory::CreateElectr CreateELSM(desc.get(), in, resPool); LoadELSMTokens(desc.get()); return desc; - } bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInputStream& in, CSimplePool* resPool) { diff --git a/Runtime/Particle/CParticleGlobals.hpp b/Runtime/Particle/CParticleGlobals.hpp index e8a755311..66487048f 100644 --- a/Runtime/Particle/CParticleGlobals.hpp +++ b/Runtime/Particle/CParticleGlobals.hpp @@ -31,10 +31,10 @@ public: m_ParticleLifetimeReal = float(frame); } - int m_ParticleLifetimePercentage = 0; - float m_ParticleLifetimePercentageReal = 0.f; - float m_ParticleLifetimePercentageRemainder = 0.f; - void UpdateParticleLifetimeTweenValues(int frame) { + int m_ParticleLifetimePercentage = 0; + float m_ParticleLifetimePercentageReal = 0.f; + float m_ParticleLifetimePercentageRemainder = 0.f; + void UpdateParticleLifetimeTweenValues(int frame) { const float lt = m_ParticleLifetime != 0 ? float(m_ParticleLifetime) : 1.0f; m_ParticleLifetimePercentageReal = 100.0f * float(frame) / lt; m_ParticleLifetimePercentage = int(m_ParticleLifetimePercentageReal); diff --git a/Runtime/Particle/CParticleSwoosh.cpp b/Runtime/Particle/CParticleSwoosh.cpp index d19da4176..c4fbc5e7f 100644 --- a/Runtime/Particle/CParticleSwoosh.cpp +++ b/Runtime/Particle/CParticleSwoosh.cpp @@ -933,8 +933,8 @@ void CParticleSwoosh::Render(const CActorLights*) { return; } - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CParticleSwoosh::Render {}"), - *x1c_desc.GetObjectTag()).c_str(), zeus::skYellow); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CParticleSwoosh::Render {}"), *x1c_desc.GetObjectTag()).c_str(), + zeus::skYellow); m_cachedVerts.clear(); if (m_dataBind[0]) { @@ -1065,7 +1065,8 @@ std::optional CParticleSwoosh::GetBounds() const { const zeus::CVector3f trans = x38_translation + xa4_globalTranslation; return zeus::CAABox(trans, trans); } else { - const zeus::CTransform xf = zeus::CTransform::Translate(xa4_globalTranslation) * xb0_globalOrientation * xec_scaleXf; + const zeus::CTransform xf = + zeus::CTransform::Translate(xa4_globalTranslation) * xb0_globalOrientation * xec_scaleXf; return zeus::CAABox(x1f0_aabbMin - x208_maxRadius, x1fc_aabbMax + x208_maxRadius).getTransformedAABox(xf); } } @@ -1074,9 +1075,7 @@ u32 CParticleSwoosh::GetParticleCount() const { return x1ac_particleCount; } bool CParticleSwoosh::SystemHasLight() const { return false; } -CLight CParticleSwoosh::GetLight() const { - return CLight::BuildLocalAmbient(zeus::skZero3f, zeus::skWhite); -} +CLight CParticleSwoosh::GetLight() const { return CLight::BuildLocalAmbient(zeus::skZero3f, zeus::skWhite); } bool CParticleSwoosh::GetParticleEmission() const { return x1d0_24_emitting; } diff --git a/Runtime/Particle/CProjectileWeaponDataFactory.cpp b/Runtime/Particle/CProjectileWeaponDataFactory.cpp index d02d0f5b6..554b54aeb 100644 --- a/Runtime/Particle/CProjectileWeaponDataFactory.cpp +++ b/Runtime/Particle/CProjectileWeaponDataFactory.cpp @@ -29,7 +29,6 @@ std::unique_ptr CProjectileWeaponDataFactory::CreateGenerato auto desc = std::make_unique(); CreateWPSM(desc.get(), in, resPool); return desc; - } bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputStream& in, CSimplePool* resPool) { diff --git a/Runtime/Weapon/CBeamProjectile.cpp b/Runtime/Weapon/CBeamProjectile.cpp index 1fb6f5440..7b5eff024 100644 --- a/Runtime/Weapon/CBeamProjectile.cpp +++ b/Runtime/Weapon/CBeamProjectile.cpp @@ -70,11 +70,13 @@ void CBeamProjectile::UpdateFx(const zeus::CTransform& xf, float dt, CStateManag x354_ = zeus::CAABox(zeus::CVector3f{-x2f4_beamRadius, 0.f, -x2f4_beamRadius}, zeus::CVector3f{x2f4_beamRadius, x304_beamLength, x2f4_beamRadius}); x36c_ = zeus::CAABox(zeus::CVector3f{-x2f4_beamRadius, 0.f, -x2f4_beamRadius}, - zeus::CVector3f{x2f4_beamRadius, x300_intBeamLength, x2f4_beamRadius}).getTransformedAABox(xf); + zeus::CVector3f{x2f4_beamRadius, x300_intBeamLength, x2f4_beamRadius}) + .getTransformedAABox(xf); EntityList nearList; mgr.BuildNearList(nearList, x36c_, CMaterialFilter::MakeExclude({EMaterialTypes::ProjectilePassthrough}), nullptr); TUniqueId collideId = kInvalidUniqueId; - CRayCastResult res = RayCollisionCheckWithWorld(collideId, x298_previousPos, beamEnd, x300_intBeamLength, nearList, mgr); + CRayCastResult res = + RayCollisionCheckWithWorld(collideId, x298_previousPos, beamEnd, x300_intBeamLength, nearList, mgr); if (TCastToConstPtr(mgr.ObjectById(collideId))) { SetCollisionResultData(EDamageType::Actor, res, collideId); if (x464_25_enableTouchDamage) diff --git a/Runtime/Weapon/CBeamProjectile.hpp b/Runtime/Weapon/CBeamProjectile.hpp index 011cbb86b..41f187086 100644 --- a/Runtime/Weapon/CBeamProjectile.hpp +++ b/Runtime/Weapon/CBeamProjectile.hpp @@ -10,11 +10,7 @@ namespace metaforce { class CBeamProjectile : public CGameProjectile { public: - enum class EDamageType { - None, - Actor, - World - }; + enum class EDamageType { None, Actor, World }; private: s32 x2e8_intMaxLength; diff --git a/Runtime/Weapon/CBomb.cpp b/Runtime/Weapon/CBomb.cpp index b5f8ec367..ce0657656 100644 --- a/Runtime/Weapon/CBomb.cpp +++ b/Runtime/Weapon/CBomb.cpp @@ -39,9 +39,9 @@ void CBomb::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManag if (msg == EScriptObjectMessage::Registered) { x188_lightId = mgr.AllocateUniqueId(); - CGameLight* gameLight = new CGameLight(x188_lightId, GetAreaIdAlways(), false, - std::string("Bomb_PLight") + GetName().data(), GetTransform(), GetUniqueId(), - x184_particle2->GetLight(), reinterpret_cast(x18c_particle2Obj), 1, 0.f); + CGameLight* gameLight = new CGameLight( + x188_lightId, GetAreaIdAlways(), false, std::string("Bomb_PLight") + GetName().data(), GetTransform(), + GetUniqueId(), x184_particle2->GetLight(), reinterpret_cast(x18c_particle2Obj), 1, 0.f); mgr.AddObject(gameLight); mgr.AddWeaponId(xec_ownerId, xf0_weaponType); CSfxManager::AddEmitter(SFXwpn_bomb_drop, GetTranslation(), {}, true, false, 0x7f, -1); diff --git a/Runtime/Weapon/CEnergyProjectile.cpp b/Runtime/Weapon/CEnergyProjectile.cpp index 485ab1a09..1f21c1c97 100644 --- a/Runtime/Weapon/CEnergyProjectile.cpp +++ b/Runtime/Weapon/CEnergyProjectile.cpp @@ -22,8 +22,8 @@ CEnergyProjectile::CEnergyProjectile(bool active, const TToken>& visorParticle, u16 visorSfx, bool sendCollideMsg) -: CGameProjectile(active, desc, "GameProjectile"sv, type, xf, excludeMat, damage, uid, aid, owner, homingTarget, attribs, - underwater, scale, visorParticle, visorSfx, sendCollideMsg) +: CGameProjectile(active, desc, "GameProjectile"sv, type, xf, excludeMat, damage, uid, aid, owner, homingTarget, + attribs, underwater, scale, visorParticle, visorSfx, sendCollideMsg) , x2ec_dir(xf.frontVector()) , x2f8_mag(x2ec_dir.magnitude()) , x2fc_camShake(CCameraShakeData::BuildProjectileCameraShake(0.5f, 0.75f)) { @@ -212,7 +212,8 @@ void CEnergyProjectile::Think(float dt, CStateManager& mgr) { } void CEnergyProjectile::Render(CStateManager& mgr) { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CEnergyProjectile::Render WPSC_{}"), x2cc_wpscId).c_str(), zeus::skOrange); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CEnergyProjectile::Render WPSC_{}"), x2cc_wpscId).c_str(), + zeus::skOrange); const auto visor = mgr.GetPlayerState()->GetActiveVisor(mgr); if (visor == CPlayerState::EPlayerVisor::Combat) { diff --git a/Runtime/Weapon/CFlameThrower.cpp b/Runtime/Weapon/CFlameThrower.cpp index 1aca091b7..1236d4bf8 100644 --- a/Runtime/Weapon/CFlameThrower.cpp +++ b/Runtime/Weapon/CFlameThrower.cpp @@ -106,7 +106,7 @@ void CFlameThrower::SetFlameLightActive(CStateManager& mgr, bool active) { } void CFlameThrower::UpdateFlameState(float dt, CStateManager& mgr) { - switch(x3f0_flameState) { + switch (x3f0_flameState) { case EFlameState::FireStart: x3f0_flameState = EFlameState::FireActive; break; @@ -184,7 +184,8 @@ CRayCastResult CFlameThrower::DoCollisionCheck(TUniqueId& idOut, const zeus::CAA break; } - const CRayCastResult cres = RayCollisionCheckWithWorld(idOut, colPoints[i], colPoints[i + 1], deltaMag, nearList, mgr); + const CRayCastResult cres = + RayCollisionCheckWithWorld(idOut, colPoints[i], colPoints[i + 1], deltaMag, nearList, mgr); if (cres.IsValid()) { return cres; } diff --git a/Runtime/Weapon/CFlameThrower.hpp b/Runtime/Weapon/CFlameThrower.hpp index 7744c8dec..7760e67ed 100644 --- a/Runtime/Weapon/CFlameThrower.hpp +++ b/Runtime/Weapon/CFlameThrower.hpp @@ -10,13 +10,8 @@ class CFlameInfo; class CElementGen; class CFlameThrower : public CGameProjectile { public: - enum class EFlameState { - Default, - FireStart, - FireActive, - FireStopTimer, - FireWaitForParticlesDone - }; + enum class EFlameState { Default, FireStart, FireActive, FireStopTimer, FireWaitForParticlesDone }; + private: static const zeus::CVector3f kLightOffset; zeus::CTransform x2e8_flameXf; @@ -41,6 +36,7 @@ private: void UpdateFlameState(float, CStateManager&); CRayCastResult DoCollisionCheck(TUniqueId& idOut, const zeus::CAABox& aabb, CStateManager& mgr); void ApplyDamageToActor(CStateManager& mgr, TUniqueId id, float dt); + public: DEFINE_ENTITY CFlameThrower(const TToken& wDesc, std::string_view name, EWeaponType wType, diff --git a/Runtime/Weapon/CGameProjectile.cpp b/Runtime/Weapon/CGameProjectile.cpp index 1623b2f3c..19772e133 100644 --- a/Runtime/Weapon/CGameProjectile.cpp +++ b/Runtime/Weapon/CGameProjectile.cpp @@ -220,7 +220,8 @@ CRayCastResult CGameProjectile::DoCollisionCheck(TUniqueId& idOut, CStateManager mgr.BuildNearList(nearList, GetProjectileBounds(), CMaterialFilter::MakeExclude(EMaterialTypes::ProjectilePassthrough), this); - res = RayCollisionCheckWithWorld(idOut, x298_previousPos, x34_transform.origin, posDelta.magnitude(), nearList, mgr); + res = + RayCollisionCheckWithWorld(idOut, x298_previousPos, x34_transform.origin, posDelta.magnitude(), nearList, mgr); } return res; } @@ -257,8 +258,7 @@ void CGameProjectile::FluidFXThink(EFluidState state, CScriptWater& water, CStat CRayCastResult CGameProjectile::RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start, const zeus::CVector3f& end, float mag, - const EntityList& nearList, - CStateManager& mgr) { + const EntityList& nearList, CStateManager& mgr) { x2d0_touchResults.clear(); idOut = kInvalidUniqueId; x2c6_pendingDamagee = kInvalidUniqueId; diff --git a/Runtime/Weapon/CGameProjectile.hpp b/Runtime/Weapon/CGameProjectile.hpp index 817514b90..1d44854e2 100644 --- a/Runtime/Weapon/CGameProjectile.hpp +++ b/Runtime/Weapon/CGameProjectile.hpp @@ -76,8 +76,7 @@ public: void ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo); void FluidFXThink(EFluidState state, CScriptWater& water, CStateManager& mgr) override; CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start, const zeus::CVector3f& end, - float mag, const EntityList& nearList, - CStateManager& mgr); + float mag, const EntityList& nearList, CStateManager& mgr); CProjectileTouchResult CanCollideWith(CActor& act, CStateManager& mgr) const; CProjectileTouchResult CanCollideWithComplexCollision(const CActor& act, const CStateManager& mgr) const; CProjectileTouchResult CanCollideWithGameObject(CActor& act, CStateManager& mgr) const; diff --git a/Runtime/Weapon/CMakeLists.txt b/Runtime/Weapon/CMakeLists.txt index 3e308fd64..9e5a1b518 100644 --- a/Runtime/Weapon/CMakeLists.txt +++ b/Runtime/Weapon/CMakeLists.txt @@ -1,38 +1,38 @@ set(WEAPON_SOURCES - WeaponCommon.hpp WeaponCommon.cpp - CWeaponMgr.hpp CWeaponMgr.cpp - CGunController.hpp CGunController.cpp - CGunMotion.hpp CGunMotion.cpp - CGrappleArm.hpp CGrappleArm.cpp - CWeaponMode.hpp - CPlayerGun.hpp CPlayerGun.cpp - CGunWeapon.hpp CGunWeapon.cpp - CAuxWeapon.hpp CAuxWeapon.cpp - CPowerBeam.hpp CPowerBeam.cpp - CIceBeam.hpp CIceBeam.cpp - CWaveBeam.hpp CWaveBeam.cpp - CPlasmaBeam.hpp CPlasmaBeam.cpp - CPhazonBeam.hpp CPhazonBeam.cpp - CGSFreeLook.hpp CGSFreeLook.cpp - CGSComboFire.hpp CGSComboFire.cpp - CGSFidget.hpp CGSFidget.cpp - CFidget.hpp CFidget.cpp - CWeapon.hpp CWeapon.cpp - CGameProjectile.hpp CGameProjectile.cpp - CBeamProjectile.hpp CBeamProjectile.cpp - CElectricBeamProjectile.hpp CElectricBeamProjectile.cpp - CTargetableProjectile.hpp CTargetableProjectile.cpp - CBeamInfo.hpp - CPlasmaProjectile.hpp CPlasmaProjectile.cpp - CEnergyProjectile.cpp CEnergyProjectile.cpp - CProjectileWeapon.hpp CProjectileWeapon.cpp - CBomb.hpp CBomb.cpp - CPowerBomb.hpp CPowerBomb.cpp - CFlameInfo.hpp CFlameInfo.cpp - CFlameThrower.hpp CFlameThrower.cpp - CWaveBuster.hpp CWaveBuster.cpp - CNewFlameThrower.hpp CNewFlameThrower.cpp - CProjectileInfo.hpp CProjectileInfo.cpp - CBurstFire.hpp CBurstFire.cpp) + WeaponCommon.hpp WeaponCommon.cpp + CWeaponMgr.hpp CWeaponMgr.cpp + CGunController.hpp CGunController.cpp + CGunMotion.hpp CGunMotion.cpp + CGrappleArm.hpp CGrappleArm.cpp + CWeaponMode.hpp + CPlayerGun.hpp CPlayerGun.cpp + CGunWeapon.hpp CGunWeapon.cpp + CAuxWeapon.hpp CAuxWeapon.cpp + CPowerBeam.hpp CPowerBeam.cpp + CIceBeam.hpp CIceBeam.cpp + CWaveBeam.hpp CWaveBeam.cpp + CPlasmaBeam.hpp CPlasmaBeam.cpp + CPhazonBeam.hpp CPhazonBeam.cpp + CGSFreeLook.hpp CGSFreeLook.cpp + CGSComboFire.hpp CGSComboFire.cpp + CGSFidget.hpp CGSFidget.cpp + CFidget.hpp CFidget.cpp + CWeapon.hpp CWeapon.cpp + CGameProjectile.hpp CGameProjectile.cpp + CBeamProjectile.hpp CBeamProjectile.cpp + CElectricBeamProjectile.hpp CElectricBeamProjectile.cpp + CTargetableProjectile.hpp CTargetableProjectile.cpp + CBeamInfo.hpp + CPlasmaProjectile.hpp CPlasmaProjectile.cpp + CEnergyProjectile.cpp CEnergyProjectile.cpp + CProjectileWeapon.hpp CProjectileWeapon.cpp + CBomb.hpp CBomb.cpp + CPowerBomb.hpp CPowerBomb.cpp + CFlameInfo.hpp CFlameInfo.cpp + CFlameThrower.hpp CFlameThrower.cpp + CWaveBuster.hpp CWaveBuster.cpp + CNewFlameThrower.hpp CNewFlameThrower.cpp + CProjectileInfo.hpp CProjectileInfo.cpp + CBurstFire.hpp CBurstFire.cpp) runtime_add_list(Weapon WEAPON_SOURCES) diff --git a/Runtime/Weapon/CNewFlameThrower.cpp b/Runtime/Weapon/CNewFlameThrower.cpp index 23f37c914..19f85c703 100644 --- a/Runtime/Weapon/CNewFlameThrower.cpp +++ b/Runtime/Weapon/CNewFlameThrower.cpp @@ -664,8 +664,7 @@ int CNewFlameThrower::SortAndFindOverlappingPoints(Cube const& box) { return min_overlap; } -bool CNewFlameThrower::FindCollisionInNearList(CStateManager& mgr, - EntityList const& near_list, +bool CNewFlameThrower::FindCollisionInNearList(CStateManager& mgr, EntityList const& near_list, CCollisionPrimitive const& coll, TUniqueId& first_coll_out, CCollisionInfoList& collisions) { for (TUniqueId const& cur_uid : near_list) { diff --git a/Runtime/Weapon/CNewFlameThrower.hpp b/Runtime/Weapon/CNewFlameThrower.hpp index 9569c1212..f7bf2849c 100644 --- a/Runtime/Weapon/CNewFlameThrower.hpp +++ b/Runtime/Weapon/CNewFlameThrower.hpp @@ -28,13 +28,7 @@ class CNewFlameThrower : public CGameProjectile { zeus::CVector3f center; float bounds; }; - enum class EFlameState { - Default, - FireStart, - FireActive, - FireStopTimer, - FireWaitForParticlesDone - }; + enum class EFlameState { Default, FireStart, FireActive, FireStopTimer, FireWaitForParticlesDone }; CRandom16 x2e8_rand{99}; float x2ec_particlesDoneTimer = 0.f; @@ -72,18 +66,16 @@ class CNewFlameThrower : public CGameProjectile { void CreateLightObjects(CStateManager& mgr); void EnableFx(CStateManager& mgr); void UpdateLights(CStateManager& mgr); - bool UpdateParticleCollisions(float dt, CStateManager &mgr, - rstl::reserved_vector &collisions_out); - bool CanDamageActor(CActor &hit_actor, CStateManager &mgr); + bool UpdateParticleCollisions(float dt, CStateManager& mgr, rstl::reserved_vector& collisions_out); + bool CanDamageActor(CActor& hit_actor, CStateManager& mgr); void AddContactPoint(CCollisionInfo const& cinfo, u32 time); int SortAndFindOverlappingPoints(Cube const& box); - bool FindCollisionInNearList(CStateManager &mgr, EntityList const &near_list, - CCollisionPrimitive const& coll, TUniqueId &first_coll_out, - CCollisionInfoList& collisions); + bool FindCollisionInNearList(CStateManager& mgr, EntityList const& near_list, CCollisionPrimitive const& coll, + TUniqueId& first_coll_out, CCollisionInfoList& collisions); void DecrementContactPointTimers(); - void SetLightsActive(CStateManager &mgr, bool active); - void UpdateFlameState(float dt, CStateManager &mgr); - void SetWorldLighting(CStateManager &mgr, TAreaId area, float speed, float target); + void SetLightsActive(CStateManager& mgr, bool active); + void UpdateFlameState(float dt, CStateManager& mgr); + void SetWorldLighting(CStateManager& mgr, TAreaId area, float speed, float target); // void RenderParticles(std::array const& elem_gens); // void LoadParticleGenQuads(); @@ -110,10 +102,10 @@ public: void UpdateFx(const zeus::CTransform& xf, float dt, CStateManager& mgr); void Reset(CStateManager& mgr, bool deactivate); void Render(CStateManager& mgr) override; - void Think(float dt, CStateManager &mgr) override; + void Think(float dt, CStateManager& mgr) override; std::optional GetTouchBounds() const override { return {}; } void Accept(IVisitor& visitor) override; - void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager &mgr) override; + void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override; void AddToRenderer(zeus::CFrustum const& planes, CStateManager& mgr) override; }; diff --git a/Runtime/Weapon/CPlasmaProjectile.cpp b/Runtime/Weapon/CPlasmaProjectile.cpp index 9a9d57abd..60f11b5d1 100644 --- a/Runtime/Weapon/CPlasmaProjectile.cpp +++ b/Runtime/Weapon/CPlasmaProjectile.cpp @@ -13,8 +13,7 @@ namespace metaforce { CPlasmaProjectile::RenderObjects::RenderObjects(boo::IGraphicsDataFactory::Context& ctx, - boo::ObjToken tex, - boo::ObjToken glowTex) + boo::ObjToken tex, boo::ObjToken glowTex) : m_beamStrip1(ctx, 8, CColoredStripShader::Mode::Additive, {}) , m_beamStrip2(ctx, 10, CColoredStripShader::Mode::FullAdditive, tex) , m_beamStrip3(ctx, 18, CColoredStripShader::Mode::FullAdditive, tex) @@ -239,8 +238,7 @@ float CPlasmaProjectile::UpdateBeamState(float dt, CStateManager& mgr) { break; case EExpansionState::Done: x4d0_shutdownTimer += dt; - if (x4d0_shutdownTimer > x484_shutdownTime && - (!x518_contactGen || x518_contactGen->GetParticleCountAll() == 0)) { + if (x4d0_shutdownTimer > x484_shutdownTime && (!x518_contactGen || x518_contactGen->GetParticleCountAll() == 0)) { x4b4_expansionState = EExpansionState::Inactive; ResetBeam(mgr, true); } @@ -259,8 +257,8 @@ void CPlasmaProjectile::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId send if (apsm) x520_weaponGen = std::make_unique(apsm.m_token); if (x520_weaponGen && x520_weaponGen->SystemHasLight()) - CreatePlasmaLights(x170_projectile.GetWeaponDescription().GetObjectTag()->id.Value(), - x520_weaponGen->GetLight(), mgr); + CreatePlasmaLights(x170_projectile.GetWeaponDescription().GetObjectTag()->id.Value(), x520_weaponGen->GetLight(), + mgr); else x520_weaponGen.reset(); if (x548_28_drawOwnerFirst) @@ -285,10 +283,9 @@ void CPlasmaProjectile::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId send void CPlasmaProjectile::MakeBillboardEffect(const std::optional>& particle, const std::optional>& electric, std::string_view name, CStateManager& mgr) { - auto* effect = new CHUDBillboardEffect(particle, electric, mgr.AllocateUniqueId(), true, name, - CHUDBillboardEffect::GetNearClipDistance(mgr), - CHUDBillboardEffect::GetScaleForPOV(mgr), - zeus::skWhite, zeus::skOne3f, zeus::skZero3f); + auto* effect = new CHUDBillboardEffect( + particle, electric, mgr.AllocateUniqueId(), true, name, CHUDBillboardEffect::GetNearClipDistance(mgr), + CHUDBillboardEffect::GetScaleForPOV(mgr), zeus::skWhite, zeus::skOne3f, zeus::skZero3f); mgr.AddObject(effect); } @@ -391,9 +388,7 @@ void CPlasmaProjectile::Touch(CActor& other, CStateManager& mgr) { // Empty } -bool CPlasmaProjectile::CanRenderUnsorted(const CStateManager& mgr) const { - return false; -} +bool CPlasmaProjectile::CanRenderUnsorted(const CStateManager& mgr) const { return false; } void CPlasmaProjectile::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) { if (GetActive()) { diff --git a/Runtime/Weapon/CPlasmaProjectile.hpp b/Runtime/Weapon/CPlasmaProjectile.hpp index 7b263ae9c..f964a5ae2 100644 --- a/Runtime/Weapon/CPlasmaProjectile.hpp +++ b/Runtime/Weapon/CPlasmaProjectile.hpp @@ -19,8 +19,8 @@ namespace metaforce { class CPlasmaProjectile : public CBeamProjectile { public: struct PlayerEffectResources : rstl::reserved_vector { - PlayerEffectResources(CAssetId a = {}, CAssetId b = {}, CAssetId c = {}, CAssetId d = {}, - CAssetId e = {}, CAssetId f = {}, CAssetId g = {}, CAssetId h = {}) + PlayerEffectResources(CAssetId a = {}, CAssetId b = {}, CAssetId c = {}, CAssetId d = {}, CAssetId e = {}, + CAssetId f = {}, CAssetId g = {}, CAssetId h = {}) : rstl::reserved_vector({a, b, c, d, e, f, g, h}) {} }; static PlayerEffectResources LoadPlayerEffectResources(CInputStream& in) { @@ -35,6 +35,7 @@ public: CAssetId h{in}; return {a, b, c, d, e, f, g, h}; } + private: std::vector x468_lights; s32 x478_beamAttributes; @@ -46,13 +47,7 @@ private: zeus::CColor x490_innerColor; zeus::CColor x494_outerColor; CDamageInfo x498_phazonDamage; - enum class EExpansionState { - Inactive, - Attack, - Sustain, - Release, - Done - }; + enum class EExpansionState { Inactive, Attack, Sustain, Release, Done }; EExpansionState x4b4_expansionState = EExpansionState::Inactive; float x4b8_beamWidth = 0.f; float x4bc_lifeTimer = 0.f; @@ -76,7 +71,7 @@ private: CAssetId x524_freezeSteamTxtr; CAssetId x528_freezeIceTxtr; TToken x52c_visorElectric; // Used to be optional - TToken x538_visorParticle; // Used to be optional + TToken x538_visorParticle; // Used to be optional u16 x544_freezeSfx; u16 x546_electricSfx; bool x548_24_ : 1 = false; @@ -96,8 +91,7 @@ private: CColoredStripShader m_beamStrip3Sub; CColoredStripShader m_beamStrip4Sub; CColoredStripShader m_motionBlurStrip; - RenderObjects(boo::IGraphicsDataFactory::Context& ctx, - boo::ObjToken tex, + RenderObjects(boo::IGraphicsDataFactory::Context& ctx, boo::ObjToken tex, boo::ObjToken glowTex); }; std::optional m_renderObjs; @@ -108,13 +102,13 @@ private: void UpdateLights(float expansion, float dt, CStateManager& mgr); void UpdateEnergyPulse(float dt); void RenderMotionBlur(); - void RenderBeam(s32 subdivs, float width, const zeus::CColor& color, s32 flags, - CColoredStripShader& shader) const; + void RenderBeam(s32 subdivs, float width, const zeus::CColor& color, s32 flags, CColoredStripShader& shader) const; float UpdateBeamState(float dt, CStateManager& mgr); void MakeBillboardEffect(const std::optional>& particle, - const std::optional>& electric, - std::string_view name, CStateManager& mgr); + const std::optional>& electric, std::string_view name, + CStateManager& mgr); void UpdatePlayerEffects(float dt, CStateManager& mgr); + public: DEFINE_ENTITY CPlasmaProjectile(const TToken& wDesc, std::string_view name, EWeaponType wType, diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index bd2495c7a..e67ffe1b4 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -248,9 +248,9 @@ void CPlayerGun::CreateGunLight(CStateManager& mgr) { if (x53c_lightId != kInvalidUniqueId) return; x53c_lightId = mgr.AllocateUniqueId(); - CGameLight* light = new CGameLight(x53c_lightId, kInvalidAreaId, false, "GunLite", x3e8_xf, x538_playerId, - CLight::BuildDirectional(zeus::skForward, zeus::skBlack), - x53c_lightId.Value(), 0, 0.f); + CGameLight* light = + new CGameLight(x53c_lightId, kInvalidAreaId, false, "GunLite", x3e8_xf, x538_playerId, + CLight::BuildDirectional(zeus::skForward, zeus::skBlack), x53c_lightId.Value(), 0, 0.f); mgr.AddObject(light); } @@ -1427,8 +1427,8 @@ void CPlayerGun::ProcessChargeState(u32 releasedStates, u32 pressedStates, CStat if ((releasedStates & 0x1) != 0) ResetCharged(dt, mgr); if ((pressedStates & 0x1) != 0) { - if (x32c_chargePhase == EChargePhase::NotCharging && (pressedStates & 0x1) != 0 && x348_chargeCooldownTimer == 0.f && - x832_28_readyForShot) { + if (x32c_chargePhase == EChargePhase::NotCharging && (pressedStates & 0x1) != 0 && + x348_chargeCooldownTimer == 0.f && x832_28_readyForShot) { UpdateNormalShotCycle(dt, mgr); x32c_chargePhase = EChargePhase::ChargeRequested; } @@ -1712,8 +1712,8 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f && player.GetPlayerMovementState() == CPlayer::EPlayerMovementState::OnGround && !player.IsInFreeLook() && !player.GetFreeLookStickState() && player.GetOrbitState() == CPlayer::EPlayerOrbitState::NoOrbit && - std::fabs(player.GetAngularVelocityOR().angle()) <= 0.1f && - camBobT <= 0.01f && !mgr.GetCameraManager()->IsInCinematicCamera() && + std::fabs(player.GetAngularVelocityOR().angle()) <= 0.1f && camBobT <= 0.01f && + !mgr.GetCameraManager()->IsInCinematicCamera() && player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn && player.GetGrappleState() == CPlayer::EGrappleState::None && !x834_30_inBigStrike && !x835_25_inPhazonBeam); if (x833_24_notFidgeting) { @@ -2101,7 +2101,8 @@ void CPlayerGun::PreRender(const CStateManager& mgr, const zeus::CFrustum& frust void CPlayerGun::RenderEnergyDrainEffects(const CStateManager& mgr) const { if (const TCastToConstPtr player = mgr.GetObjectById(x538_playerId)) { for (const auto& source : player->GetEnergyDrain().GetEnergyDrainSources()) { - if (const auto* metroid = CPatterned::CastTo(mgr.GetObjectById(source.GetEnergyDrainSourceId()))) { + if (const auto* metroid = + CPatterned::CastTo(mgr.GetObjectById(source.GetEnergyDrainSourceId()))) { metroid->RenderHitGunEffect(); return; } diff --git a/Runtime/Weapon/CPlayerGun.hpp b/Runtime/Weapon/CPlayerGun.hpp index d04f755fe..5999aba2f 100644 --- a/Runtime/Weapon/CPlayerGun.hpp +++ b/Runtime/Weapon/CPlayerGun.hpp @@ -87,8 +87,7 @@ private: public: CGunMorph(float gunTransformTime, float holoHoldTime) - : x4_gunTransformTime(gunTransformTime) - , x10_holoHoldTime(std::fabs(holoHoldTime)) {} + : x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(std::fabs(holoHoldTime)) {} float GetYLerp() const { return x0_yLerp; } float GetTransitionFactor() const { return x18_transitionFactor; } EGunState GetGunState() const { return x20_gunState; } diff --git a/Runtime/Weapon/CPowerBomb.cpp b/Runtime/Weapon/CPowerBomb.cpp index dce9c62e1..472aeeb7f 100644 --- a/Runtime/Weapon/CPowerBomb.cpp +++ b/Runtime/Weapon/CPowerBomb.cpp @@ -89,9 +89,7 @@ void CPowerBomb::Think(float dt, CStateManager& mgr) { x15c_curTime += dt; } -void CPowerBomb::AddToRenderer(const zeus::CFrustum&, CStateManager&) { - g_Renderer->AddParticleGen(*x168_particle); -} +void CPowerBomb::AddToRenderer(const zeus::CFrustum&, CStateManager&) { g_Renderer->AddParticleGen(*x168_particle); } void CPowerBomb::ApplyDynamicDamage(const zeus::CVector3f& pos, metaforce::CStateManager& mgr) { mgr.ApplyDamageToWorld(xec_ownerId, *this, pos, x12c_curDamageInfo, xf8_filter); diff --git a/Runtime/Weapon/CProjectileInfo.cpp b/Runtime/Weapon/CProjectileInfo.cpp index 140cbc4cb..6ab2e123e 100644 --- a/Runtime/Weapon/CProjectileInfo.cpp +++ b/Runtime/Weapon/CProjectileInfo.cpp @@ -39,8 +39,8 @@ zeus::CVector3f CProjectileInfo::PredictInterceptPos(const zeus::CVector3f& gunP } else { vel = playerVel; } - result = CSteeringBehaviors::ProjectOrbitalIntersection(gunPos, speed, dt, aimPos, vel, - player.GetOrbitPoint(), ret); + result = + CSteeringBehaviors::ProjectOrbitalIntersection(gunPos, speed, dt, aimPos, vel, player.GetOrbitPoint(), ret); break; } case CPlayer::EPlayerOrbitState::NoOrbit: diff --git a/Runtime/Weapon/CProjectileWeapon.cpp b/Runtime/Weapon/CProjectileWeapon.cpp index bbe62ec50..020033b53 100644 --- a/Runtime/Weapon/CProjectileWeapon.cpp +++ b/Runtime/Weapon/CProjectileWeapon.cpp @@ -147,9 +147,11 @@ s32 CProjectileWeapon::GetSoundIdForCollision(EWeaponCollisionResponseTypes type return x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type); } -std::optional> CProjectileWeapon::CollisionOccured( - EWeaponCollisionResponseTypes type, bool deflected, bool useTarget, const zeus::CVector3f& pos, - const zeus::CVector3f& normal, const zeus::CVector3f& target) { +std::optional> CProjectileWeapon::CollisionOccured(EWeaponCollisionResponseTypes type, + bool deflected, bool useTarget, + const zeus::CVector3f& pos, + const zeus::CVector3f& normal, + const zeus::CVector3f& target) { x80_localOffset = x14_localToWorldXf.transposeRotate(pos - x74_worldOffset) - x8c_projOffset; zeus::CVector3f posToTarget = target - GetTranslation(); if (deflected) { diff --git a/Runtime/Weapon/CProjectileWeapon.hpp b/Runtime/Weapon/CProjectileWeapon.hpp index 10be49cd9..32c899794 100644 --- a/Runtime/Weapon/CProjectileWeapon.hpp +++ b/Runtime/Weapon/CProjectileWeapon.hpp @@ -73,14 +73,12 @@ public: float GetMaxTurnRate() const { return xe0_maxTurnRate; } float GetAudibleFallOff() const; float GetAudibleRange() const; - std::optional> - GetDecalForCollision(EWeaponCollisionResponseTypes type) const; + std::optional> GetDecalForCollision(EWeaponCollisionResponseTypes type) const; s32 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const; - std::optional> CollisionOccured(EWeaponCollisionResponseTypes type, - bool deflected, bool useTarget, - const zeus::CVector3f& pos, - const zeus::CVector3f& normal, - const zeus::CVector3f& target); + std::optional> CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, + bool useTarget, const zeus::CVector3f& pos, + const zeus::CVector3f& normal, + const zeus::CVector3f& target); TLockedToken GetWeaponDescription() const { return x4_weaponDesc; } void RenderParticles() const; virtual void AddToRenderer(); diff --git a/Runtime/Weapon/CWeapon.cpp b/Runtime/Weapon/CWeapon.cpp index 3af683635..32f5538e7 100644 --- a/Runtime/Weapon/CWeapon.cpp +++ b/Runtime/Weapon/CWeapon.cpp @@ -72,8 +72,7 @@ void CWeapon::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager break; } - if (True(xe8_projectileAttribs & EProjectileAttrib::ComboShot) && - state != EFluidState::InFluid) + if (True(xe8_projectileAttribs & EProjectileAttrib::ComboShot) && state != EFluidState::InFluid) mag += 0.5f; if (True(xe8_projectileAttribs & EProjectileAttrib::Charged)) mag += 0.25f; diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index b949be030..ed8d6c360 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -210,7 +210,8 @@ void CActor::DrawTouchBounds() { void CActor::RenderInternal(const CStateManager& mgr) const { SCOPED_GRAPHICS_DEBUG_GROUP( - fmt::format(FMT_STRING("CActor::RenderInternal {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); + fmt::format(FMT_STRING("CActor::RenderInternal {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), + zeus::skOrange); CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); if (which == CModelData::EWhichModel::ThermalHot) { diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 877b87be3..7fdd2ea42 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -87,6 +87,7 @@ protected: bool IsModelOpaque(const CStateManager& mgr) const; CAABoxShader m_actorDebugRender; + public: enum class EFluidState { EnteredFluid, InFluid, LeftFluid }; diff --git a/Runtime/World/CActorModelParticles.cpp b/Runtime/World/CActorModelParticles.cpp index b9d97af7f..cabfefb19 100644 --- a/Runtime/World/CActorModelParticles.cpp +++ b/Runtime/World/CActorModelParticles.cpp @@ -26,10 +26,7 @@ static bool IsMediumOrLarge(const CActor& act) { } CActorModelParticles::CItem::CItem(const CEntity& ent, CActorModelParticles& parent) -: x0_id(ent.GetUniqueId()) -, x4_areaId(ent.GetAreaIdAlways()) -, xdc_ashy(parent.x48_ashy) -, x128_parent(parent) { +: x0_id(ent.GetUniqueId()), x4_areaId(ent.GetAreaIdAlways()), xdc_ashy(parent.x48_ashy), x128_parent(parent) { x8_onFireGens.resize(8); } @@ -68,8 +65,7 @@ void CActorModelParticles::CItem::GeneratePoints(const std::vectorSetOrientation( - zeus::CTransform{v.cross(zeus::skUp), v, zeus::skUp, zeus::skZero3f}); + x78_ashGen->SetOrientation(zeus::CTransform{v.cross(zeus::skUp), v, zeus::skUp, zeus::skZero3f}); } x78_ashGen->ForceParticleCreation(1); } @@ -411,9 +407,7 @@ std::unique_ptr CActorModelParticles::MakeOnFireGen() const { return std::make_unique(x18_onFire); } -std::unique_ptr CActorModelParticles::MakeAshGen() const { - return std::make_unique(x20_ash); -} +std::unique_ptr CActorModelParticles::MakeAshGen() const { return std::make_unique(x20_ash); } std::unique_ptr CActorModelParticles::MakeIceGen() const { return std::make_unique(x28_iceBreak); diff --git a/Runtime/World/CAi.hpp b/Runtime/World/CAi.hpp index f70a59655..b234655ea 100644 --- a/Runtime/World/CAi.hpp +++ b/Runtime/World/CAi.hpp @@ -25,6 +25,7 @@ class CTeamAiRole; class CAi : public CPhysicsActor { static CAiFuncMap* m_FuncMap; + protected: CHealthInfo x258_healthInfo; CDamageVulnerability x260_damageVulnerability; diff --git a/Runtime/World/CAmbientAI.hpp b/Runtime/World/CAmbientAI.hpp index ea23d483f..e83620cad 100644 --- a/Runtime/World/CAmbientAI.hpp +++ b/Runtime/World/CAmbientAI.hpp @@ -38,10 +38,10 @@ public: void Accept(IVisitor&) override; void Think(float, CStateManager&) override; void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; - CHealthInfo* HealthInfo(CStateManager&) override{ return &x260_healthInfo; } - const CDamageVulnerability* GetDamageVulnerability() const override{ return &x268_dVuln; } + CHealthInfo* HealthInfo(CStateManager&) override { return &x260_healthInfo; } + const CDamageVulnerability* GetDamageVulnerability() const override { return &x268_dVuln; } std::optional GetTouchBounds() const override; - void Touch(CActor&, CStateManager&) override{} + void Touch(CActor&, CStateManager&) override {} void RandomizePlaybackRate(CStateManager&); }; diff --git a/Runtime/World/CDamageVulnerability.cpp b/Runtime/World/CDamageVulnerability.cpp index 495f17699..dcf5ffe48 100644 --- a/Runtime/World/CDamageVulnerability.cpp +++ b/Runtime/World/CDamageVulnerability.cpp @@ -42,9 +42,7 @@ static constexpr bool is_deflect_direct(EVulnerability vuln) { static constexpr bool is_normal_or_weak(EVulnerability vuln) { return vuln == EVulnerability::Weak || vuln == EVulnerability::Normal; } -static constexpr bool is_not_deflect(EVulnerability vuln) { - return vuln != EVulnerability::Deflect; -} +static constexpr bool is_not_deflect(EVulnerability vuln) { return vuln != EVulnerability::Deflect; } void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount) { propCount -= 3; diff --git a/Runtime/World/CEntity.hpp b/Runtime/World/CEntity.hpp index 6005aeb77..37c920fac 100644 --- a/Runtime/World/CEntity.hpp +++ b/Runtime/World/CEntity.hpp @@ -46,6 +46,7 @@ protected: bool m_debugSelected = false; bool m_debugHovered = false; const std::set* m_incomingConnections = nullptr; + public: static const std::vector NullConnectionList; virtual ~CEntity() = default; @@ -83,9 +84,7 @@ public: const std::vector& GetConnectionList() const { return x20_conns; } std::string_view GetName() const { return x10_name; } - void SetIncomingConnectionList(const std::set* conns) { - m_incomingConnections = conns; - } + void SetIncomingConnectionList(const std::set* conns) { m_incomingConnections = conns; } }; } // namespace metaforce diff --git a/Runtime/World/CEntityInfo.hpp b/Runtime/World/CEntityInfo.hpp index a3c51f1b6..ff8a0f28b 100644 --- a/Runtime/World/CEntityInfo.hpp +++ b/Runtime/World/CEntityInfo.hpp @@ -13,9 +13,7 @@ struct SConnection { bool operator==(const SConnection& other) const { return x0_state == other.x0_state && x4_msg == other.x4_msg && x8_objId == other.x8_objId; } - bool operator<(const SConnection& other) const { - return x8_objId < other.x8_objId; - } + bool operator<(const SConnection& other) const { return x8_objId < other.x8_objId; } }; class CEntityInfo { diff --git a/Runtime/World/CEnvFxManager.cpp b/Runtime/World/CEnvFxManager.cpp index 962d4ec47..66bc6b9db 100644 --- a/Runtime/World/CEnvFxManager.cpp +++ b/Runtime/World/CEnvFxManager.cpp @@ -17,7 +17,6 @@ #include "TCastTo.hpp" // Generated file, do not modify include path - namespace metaforce { static rstl::reserved_vector g_SnowForces; @@ -77,10 +76,10 @@ void CEnvFxManager::UpdateRainSounds(const CStateManager& mgr) { zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); float rainVol = CalcRainVolume(x30_fxDensity); if (!xb6a_rainSoundActive) { - xb6c_leftRainSound = CSfxManager::AddEmitter(SFXsfx09F0, zeus::skZero3f, zeus::skZero3f, false, - true, 0xff, kInvalidAreaId); - xb70_rightRainSound = CSfxManager::AddEmitter(SFXsfx09F1, zeus::skZero3f, zeus::skZero3f, false, - true, 0xff, kInvalidAreaId); + xb6c_leftRainSound = + CSfxManager::AddEmitter(SFXsfx09F0, zeus::skZero3f, zeus::skZero3f, false, true, 0xff, kInvalidAreaId); + xb70_rightRainSound = + CSfxManager::AddEmitter(SFXsfx09F1, zeus::skZero3f, zeus::skZero3f, false, true, 0xff, kInvalidAreaId); xb6a_rainSoundActive = true; } CSfxManager::UpdateEmitter(xb6c_leftRainSound, camXf.origin - camXf.basis[0], camXf.basis[0], rainVol); @@ -209,10 +208,9 @@ void CEnvFxManager::UpdateBlockedGrids(CStateManager& mgr, EEnvFxType type, cons constexpr auto filter = CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid, EMaterialTypes::Trigger}, {EMaterialTypes::ProjectilePassthrough, EMaterialTypes::SeeThrough}); - zeus::CVector3f pos = xf * zeus::CVector3f((grid.x4_position + grid.xc_extent * 0).toVec2f() / 256.f) + - zeus::skUp * 500.f; - CRayCastResult result = - CGameCollision::RayStaticIntersection(mgr, pos, zeus::skDown, 1000.f, filter); + zeus::CVector3f pos = + xf * zeus::CVector3f((grid.x4_position + grid.xc_extent * 0).toVec2f() / 256.f) + zeus::skUp * 500.f; + CRayCastResult result = CGameCollision::RayStaticIntersection(mgr, pos, zeus::skDown, 1000.f, filter); if (result.IsValid()) { if (!blockListBuilt) { BuildBlockObjectList(blockList, mgr); diff --git a/Runtime/World/CFishCloud.cpp b/Runtime/World/CFishCloud.cpp index e5175a55a..a14551bb6 100644 --- a/Runtime/World/CFishCloud.cpp +++ b/Runtime/World/CFishCloud.cpp @@ -140,8 +140,7 @@ zeus::CPlane CFishCloud::FindClosestPlane(const zeus::CAABox& aabb, const zeus:: } const auto tri = unAabb.getTri(minFace, 0); - return zeus::CPlane(GetTransform() * tri.x10_verts[0], - GetTransform() * tri.x10_verts[2], + return zeus::CPlane(GetTransform() * tri.x10_verts[0], GetTransform() * tri.x10_verts[2], GetTransform() * tri.x10_verts[1]); } } @@ -275,8 +274,8 @@ void CFishCloud::ApplySeparation(CBoid& boid, const rstl::reserved_vector capDistSq) ? 0.f : (1.f - distSq / capDistSq)) * delta.normalized() * attractionMagnitude; } -void CFishCloud::ApplyRepulsion(CBoid& boid, const zeus::CVector3f& attractTo, - float repulsionRadius, float repulsionMagnitude) const { +void CFishCloud::ApplyRepulsion(CBoid& boid, const zeus::CVector3f& attractTo, float repulsionRadius, + float repulsionMagnitude) const { ApplySeparation(boid, attractTo, repulsionRadius, repulsionMagnitude); } -void CFishCloud::ApplySwirl(CBoid& boid, const zeus::CVector3f& swirlPoint, bool clockwise, - float magnitude, float radius) const { +void CFishCloud::ApplySwirl(CBoid& boid, const zeus::CVector3f& swirlPoint, bool clockwise, float magnitude, + float radius) const { const zeus::CVector3f delta = boid.x0_pos - swirlPoint; const float deltaMag = delta.magnitude(); @@ -362,8 +360,7 @@ void CFishCloud::ApplySwirl(CBoid& boid, const zeus::CVector3f& swirlPoint, bool } const float weight = deltaMag > radius ? 0.f : 1.f - deltaMag / radius; - boid.xc_vel += zeus::CVector3f::getAngleDiff(boid.xc_vel, alignVec) / M_PIF * - weight * (magnitude * alignVec); + boid.xc_vel += zeus::CVector3f::getAngleDiff(boid.xc_vel, alignVec) / M_PIF * weight * (magnitude * alignVec); } void CFishCloud::ApplyContainment(CBoid& boid, const zeus::CAABox& aabb) const { @@ -509,9 +506,7 @@ void CFishCloud::Think(float dt, CStateManager& mgr) { } } -void CFishCloud::CreatePartitionList() { - xf8_boidPartitionLists.reserve(343); -} +void CFishCloud::CreatePartitionList() { xf8_boidPartitionLists.reserve(343); } void CFishCloud::AllocateSkinnedModels(CStateManager& mgr, CModelData::EWhichModel which) { int idx = 0; @@ -569,8 +564,8 @@ void CFishCloud::AddParticlesToRenderer() const { } } -void CFishCloud::RenderBoid(int idx, const CBoid& boid, u32& drawMask, - bool thermalHot, const CModelFlags& flags) const { +void CFishCloud::RenderBoid(int idx, const CBoid& boid, u32& drawMask, bool thermalHot, + const CModelFlags& flags) const { const u32 modelIndex = idx & 0x3; CModelData& mData = *x1b0_models[modelIndex]; CSkinnedModel& model = mData.PickAnimatedModel(CModelData::EWhichModel::Normal); @@ -599,8 +594,8 @@ void CFishCloud::Render(CStateManager& mgr) { return; } - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CFishCloud::Render {} {} {}"), - x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); + SCOPED_GRAPHICS_DEBUG_GROUP( + fmt::format(FMT_STRING("CFishCloud::Render {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); const bool thermalHot = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot; CModelFlags flags(0, 0, 3, zeus::skWhite); @@ -633,13 +628,9 @@ void CFishCloud::Render(CStateManager& mgr) { } } -void CFishCloud::CalculateRenderBounds() { - x9c_renderBounds = GetBoundingBox(); -} +void CFishCloud::CalculateRenderBounds() { x9c_renderBounds = GetBoundingBox(); } -std::optional CFishCloud::GetTouchBounds() const { - return {GetBoundingBox()}; -} +std::optional CFishCloud::GetTouchBounds() const { return {GetBoundingBox()}; } void CFishCloud::CreateBoidDeathParticle(CBoid& b) const { auto it = x21c_deathParticleCounts.begin(); diff --git a/Runtime/World/CFishCloud.hpp b/Runtime/World/CFishCloud.hpp index 47064d0d7..3b7c424c9 100644 --- a/Runtime/World/CFishCloud.hpp +++ b/Runtime/World/CFishCloud.hpp @@ -19,6 +19,7 @@ class CFishCloud : public CActor { float x18_scale; CBoid* x1c_next = nullptr; bool x20_active = true; + public: CBoid(const zeus::CVector3f& pos, const zeus::CVector3f& vel, float scale) : x0_pos(pos), xc_vel(vel), x18_scale(scale) {} @@ -32,6 +33,7 @@ class CFishCloud : public CActor { float x8_priority; bool xc_isRepulsor; bool xd_isSwirl; + public: CModifierSource(TUniqueId source, bool repulsor, bool swirl, float radius, float priority) : x0_source(source), x4_radius(radius), x8_priority(priority), xc_isRepulsor(repulsor), xd_isSwirl(swirl) {} @@ -74,8 +76,8 @@ class CFishCloud : public CActor { float x170_weaponKillRadius; float x174_containmentRadius; /* Used to be position and normal arrays */ - //rstl::reserved_vector, 4> x178_; - //rstl::reserved_vector, 4> x19c_; + // rstl::reserved_vector, 4> x178_; + // rstl::reserved_vector, 4> x19c_; rstl::reserved_vector, 4> x1b0_models; rstl::reserved_vector, 4> x1c4_particleDescs; rstl::reserved_vector, 4> x1f8_particleGens; @@ -103,16 +105,16 @@ class CFishCloud : public CActor { rstl::reserved_vector& nearList); void PlaceBoid(CStateManager& mgr, CBoid& boid, const zeus::CAABox& aabb) const; void ApplySeparation(CBoid& boid, const rstl::reserved_vector& nearList) const; - void ApplySeparation(CBoid& boid, const zeus::CVector3f& separateFrom, - float separationRadius, float separationMagnitude) const; + void ApplySeparation(CBoid& boid, const zeus::CVector3f& separateFrom, float separationRadius, + float separationMagnitude) const; void ApplyCohesion(CBoid& boid, const rstl::reserved_vector& nearList) const; - void ApplyCohesion(CBoid& boid, const zeus::CVector3f& cohesionFrom, - float cohesionRadius, float cohesionMagnitude) const; + void ApplyCohesion(CBoid& boid, const zeus::CVector3f& cohesionFrom, float cohesionRadius, + float cohesionMagnitude) const; void ApplyAlignment(CBoid& boid, const rstl::reserved_vector& nearList) const; - void ApplyAttraction(CBoid& boid, const zeus::CVector3f& attractTo, - float attractionRadius, float attractionMagnitude) const; - void ApplyRepulsion(CBoid& boid, const zeus::CVector3f& attractTo, - float repulsionRadius, float repulsionMagnitude) const; + void ApplyAttraction(CBoid& boid, const zeus::CVector3f& attractTo, float attractionRadius, + float attractionMagnitude) const; + void ApplyRepulsion(CBoid& boid, const zeus::CVector3f& attractTo, float repulsionRadius, + float repulsionMagnitude) const; void ApplySwirl(CBoid& boid, const zeus::CVector3f& swirlPoint, bool clockwise, float magnitude, float radius) const; void ApplyContainment(CBoid& boid, const zeus::CAABox& aabb) const; void ScatterBoid(CStateManager& mgr, CBoid& b) const; @@ -127,13 +129,12 @@ class CFishCloud : public CActor { public: DEFINE_ENTITY - CFishCloud(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, - const zeus::CVector3f& scale, const zeus::CTransform& xf, CModelData&& mData, - const CAnimRes& aRes, u32 numBoids, float speed, float separationRadius, float cohesionMagnitude, - float alignmentWeight, float separationMagnitude, float weaponRepelMagnitude, - float playerRepelMagnitude, float containmentMagnitude, float scatterVel, float maxScatterAngle, - float weaponRepelDampingSpeed, float playerRepelDampingSpeed, float containmentRadius, - u32 updateShift, const zeus::CColor& color, bool killable, float weaponKillRadius, + CFishCloud(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& scale, + const zeus::CTransform& xf, CModelData&& mData, const CAnimRes& aRes, u32 numBoids, float speed, + float separationRadius, float cohesionMagnitude, float alignmentWeight, float separationMagnitude, + float weaponRepelMagnitude, float playerRepelMagnitude, float containmentMagnitude, float scatterVel, + float maxScatterAngle, float weaponRepelDampingSpeed, float playerRepelDampingSpeed, + float containmentRadius, u32 updateShift, const zeus::CColor& color, bool killable, float weaponKillRadius, CAssetId part1, u32 partCount1, CAssetId part2, u32 partCount2, CAssetId part3, u32 partCount3, CAssetId part4, u32 partCount4, u32 deathSfx, bool repelFromThreats, bool hotInThermal); diff --git a/Runtime/World/CFishCloudModifier.hpp b/Runtime/World/CFishCloudModifier.hpp index 3fb3bdeef..519d76890 100644 --- a/Runtime/World/CFishCloudModifier.hpp +++ b/Runtime/World/CFishCloudModifier.hpp @@ -12,8 +12,7 @@ class CFishCloudModifier : public CActor { public: DEFINE_ENTITY CFishCloudModifier(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& eInfo, - const zeus::CVector3f& pos, bool isRepulsor, bool swirl, float radius, - float priority); + const zeus::CVector3f& pos, bool isRepulsor, bool swirl, float radius, float priority); void Accept(IVisitor& visitor) override; void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; diff --git a/Runtime/World/CFluidPlane.cpp b/Runtime/World/CFluidPlane.cpp index 47a430a30..1cc5ad4ad 100644 --- a/Runtime/World/CFluidPlane.cpp +++ b/Runtime/World/CFluidPlane.cpp @@ -355,20 +355,18 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, const H TriFanToStrip toStrip(vOut); toStrip.EmplaceVert( - zeus::CVector3f(xMax + 0.5f * info.x14_tileSize, yMax + 0.5f * info.x14_tileSize, 0.f), - zeus::skUp, zeus::skBlack); + zeus::CVector3f(xMax + 0.5f * info.x14_tileSize, yMax + 0.5f * info.x14_tileSize, 0.f), zeus::skUp, + zeus::skBlack); float tmp = xMax; for (int v = 0; v < ((curYTile == 1) ? CFluidPlaneRender::numSubdivisionsInTile : 1); ++v) { - toStrip.EmplaceVert(zeus::CVector3f(tmp, yMax + info.x14_tileSize, 0.f), zeus::skUp, - zeus::skBlack); + toStrip.EmplaceVert(zeus::CVector3f(tmp, yMax + info.x14_tileSize, 0.f), zeus::skUp, zeus::skBlack); tmp += info.x18_rippleResolution; } tmp = yMax + info.x14_tileSize; for (int v = 0; v < ((xTiles - 1 == curXTile) ? CFluidPlaneRender::numSubdivisionsInTile : 1); ++v) { - toStrip.EmplaceVert(zeus::CVector3f(xMax + info.x14_tileSize, tmp, 0.f), zeus::skUp, - zeus::skBlack); + toStrip.EmplaceVert(zeus::CVector3f(xMax + info.x14_tileSize, tmp, 0.f), zeus::skUp, zeus::skBlack); tmp -= info.x18_rippleResolution; } @@ -384,8 +382,7 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, const H tmp += info.x18_rippleResolution; } - toStrip.EmplaceVert(zeus::CVector3f(xMax, yMax + info.x14_tileSize, 0.f), zeus::skUp, - zeus::skBlack); + toStrip.EmplaceVert(zeus::CVector3f(xMax, yMax + info.x14_tileSize, 0.f), zeus::skUp, zeus::skBlack); toStrip.Draw(); @@ -399,8 +396,7 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, const H size_t start = vOut.size(); for (int v = 0; v < nextXTile - curXTile + 1; ++v) { vOut.emplace_back(zeus::CVector3f(xMax, yMax, 0.f), zeus::skUp, zeus::skBlack); - vOut.emplace_back(zeus::CVector3f(xMax, yMax + info.x14_tileSize, 0.f), zeus::skUp, - zeus::skBlack); + vOut.emplace_back(zeus::CVector3f(xMax, yMax + info.x14_tileSize, 0.f), zeus::skUp, zeus::skBlack); xMax += info.x14_tileSize; } CGraphics::DrawArray(start, vOut.size() - start); @@ -426,14 +422,10 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, const H case CFluidPlaneRender::NormalMode::NBT: { if (flagIs1 || !info.x30_gridFlags) { size_t start = vOut.size(); - vOut.emplace_back(zeus::CVector3f(xMin, yMin, 0.f), zeus::skUp, zeus::skForward, - zeus::skRight, zeus::skBlack); - vOut.emplace_back(zeus::CVector3f(xMin, yMax, 0.f), zeus::skUp, zeus::skForward, - zeus::skRight, zeus::skBlack); - vOut.emplace_back(zeus::CVector3f(xMax, yMin, 0.f), zeus::skUp, zeus::skForward, - zeus::skRight, zeus::skBlack); - vOut.emplace_back(zeus::CVector3f(xMax, yMax, 0.f), zeus::skUp, zeus::skForward, - zeus::skRight, zeus::skBlack); + vOut.emplace_back(zeus::CVector3f(xMin, yMin, 0.f), zeus::skUp, zeus::skForward, zeus::skRight, zeus::skBlack); + vOut.emplace_back(zeus::CVector3f(xMin, yMax, 0.f), zeus::skUp, zeus::skForward, zeus::skRight, zeus::skBlack); + vOut.emplace_back(zeus::CVector3f(xMax, yMin, 0.f), zeus::skUp, zeus::skForward, zeus::skRight, zeus::skBlack); + vOut.emplace_back(zeus::CVector3f(xMax, yMax, 0.f), zeus::skUp, zeus::skForward, zeus::skRight, zeus::skBlack); CGraphics::DrawArray(start, 4); } else { int xTiles = (info.x0_xSubdivs - 3) / CFluidPlaneRender::numSubdivisionsInTile + 1; @@ -453,10 +445,10 @@ void CFluidPlane::RenderPatch(const CFluidPlaneRender::SPatchInfo& info, const H size_t start = vOut.size(); for (int v = 0; v < nextXTile - curXTile + 1; ++v) { - vOut.emplace_back(zeus::CVector3f(xMax, yMin, 0.f), zeus::skUp, zeus::skForward, + vOut.emplace_back(zeus::CVector3f(xMax, yMin, 0.f), zeus::skUp, zeus::skForward, zeus::skRight, + zeus::skBlack); + vOut.emplace_back(zeus::CVector3f(xMax, yMin + info.x14_tileSize, 0.f), zeus::skUp, zeus::skForward, zeus::skRight, zeus::skBlack); - vOut.emplace_back(zeus::CVector3f(xMax, yMin + info.x14_tileSize, 0.f), zeus::skUp, - zeus::skForward, zeus::skRight, zeus::skBlack); xMax += info.x14_tileSize; } CGraphics::DrawArray(start, vOut.size() - start); diff --git a/Runtime/World/CFluidPlane.hpp b/Runtime/World/CFluidPlane.hpp index 753a0df56..e1bdd8a30 100644 --- a/Runtime/World/CFluidPlane.hpp +++ b/Runtime/World/CFluidPlane.hpp @@ -166,8 +166,8 @@ public: virtual void Render(const CStateManager& mgr, float alpha, const zeus::CAABox& aabb, const zeus::CTransform& xf, const zeus::CTransform& areaXf, bool noNormals, const zeus::CFrustum& frustum, - const std::optional& rippleManager, TUniqueId waterId, - const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) {} + const std::optional& rippleManager, TUniqueId waterId, const bool* gridFlags, + u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) {} float GetAlpha() const { return x40_alpha; } EFluidType GetFluidType() const { return x44_fluidType; } diff --git a/Runtime/World/CFluidPlaneCPU.cpp b/Runtime/World/CFluidPlaneCPU.cpp index d4fe09a1f..3c48d0e4e 100644 --- a/Runtime/World/CFluidPlaneCPU.cpp +++ b/Runtime/World/CFluidPlaneCPU.cpp @@ -256,8 +256,8 @@ CFluidPlaneShader::RenderSetupInfo CFluidPlaneCPU::RenderSetup(const CStateManag out.kColors[2] = zeus::CColor(lowLightBlend * lightLevel, 1.f); } - float waterPlaneOrthoDot = xf.transposeRotate(zeus::skUp) - .dot(CGraphics::g_ViewMatrix.inverse().transposeRotate(zeus::skForward)); + float waterPlaneOrthoDot = + xf.transposeRotate(zeus::skUp).dot(CGraphics::g_ViewMatrix.inverse().transposeRotate(zeus::skForward)); if (waterPlaneOrthoDot < 0.f) waterPlaneOrthoDot = -waterPlaneOrthoDot; @@ -740,14 +740,13 @@ static CFluidPlane::Flags lc_flags{}; void CFluidPlaneCPU::Render(const CStateManager& mgr, float alpha, const zeus::CAABox& aabb, const zeus::CTransform& xf, const zeus::CTransform& areaXf, bool noNormals, const zeus::CFrustum& frustum, const std::optional& rippleManager, TUniqueId waterId, - const bool* gridFlags, u32 gridDimX, u32 gridDimY, - const zeus::CVector3f& areaCenter) { + const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) { SCOPED_GRAPHICS_DEBUG_GROUP("CFluidPlaneCPU::Render", zeus::skCyan); TCastToConstPtr water = mgr.GetObjectById(waterId); CFluidPlaneShader::RenderSetupInfo setupInfo = RenderSetup(mgr, alpha, xf, areaXf, aabb, water.GetPtr()); - //if (!m_shader->isReady()) - // return; + // if (!m_shader->isReady()) + // return; CFluidPlaneRender::NormalMode normalMode; if (xb0_bumpMap && kEnableWaterBumpMaps) @@ -800,9 +799,8 @@ void CFluidPlaneCPU::Render(const CStateManager& mgr, float alpha, const zeus::C } if (water) { - float cameraPenetration = - mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation().dot(zeus::skUp) - - water->GetTriggerBoundsWR().max.z(); + float cameraPenetration = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation().dot(zeus::skUp) - + water->GetTriggerBoundsWR().max.z(); wavecapIntensityScale *= (cameraPenetration >= 0.5f || cameraPenetration < 0.f) ? 1.f : 2.f * cameraPenetration; } diff --git a/Runtime/World/CFluidPlaneDoor.cpp b/Runtime/World/CFluidPlaneDoor.cpp index fb7e3e2e8..4f80c7f87 100644 --- a/Runtime/World/CFluidPlaneDoor.cpp +++ b/Runtime/World/CFluidPlaneDoor.cpp @@ -58,15 +58,14 @@ static CFluidPlane::Flags lc_flags{}; void CFluidPlaneDoor::Render(const CStateManager& mgr, float alpha, const zeus::CAABox& aabb, const zeus::CTransform& xf, const zeus::CTransform& areaXf, bool noNormals, - const zeus::CFrustum& frustum, - const std::optional& rippleManager, TUniqueId waterId, - const bool* gridFlags, u32 gridDimX, u32 gridDimY, + const zeus::CFrustum& frustum, const std::optional& rippleManager, + TUniqueId waterId, const bool* gridFlags, u32 gridDimX, u32 gridDimY, const zeus::CVector3f& areaCenter) { SCOPED_GRAPHICS_DEBUG_GROUP("CFluidPlaneDoor::Render", zeus::skCyan); CFluidPlaneShader::RenderSetupInfo setupInfo = RenderSetup(mgr, alpha, xf, aabb, noNormals); - //if (!m_shader->isReady()) - // return; + // if (!m_shader->isReady()) + // return; CFluidPlaneRender::numSubdivisionsInTile = xa4_tileSubdivisions; CFluidPlaneRender::numTilesInHField = 42 / xa4_tileSubdivisions; diff --git a/Runtime/World/CFluidPlaneManager.cpp b/Runtime/World/CFluidPlaneManager.cpp index 186991c71..3ffbaa8e8 100644 --- a/Runtime/World/CFluidPlaneManager.cpp +++ b/Runtime/World/CFluidPlaneManager.cpp @@ -67,13 +67,12 @@ void CFluidPlaneManager::CreateSplash(TUniqueId splasher, CStateManager& mgr, co if (water.GetSplashEffect(factor)) { CExplosion* expl = new CExplosion(*water.GetSplashEffect(factor), mgr.AllocateUniqueId(), true, CEntityInfo(water.GetAreaIdAlways(), CEntity::NullConnectionList), "Splash", - zeus::CTransform(zeus::CMatrix3f(), pos), 1, - zeus::CVector3f{splashScale}, water.GetSplashColor()); + zeus::CTransform(zeus::CMatrix3f(), pos), 1, zeus::CVector3f{splashScale}, + water.GetSplashColor()); mgr.AddObject(expl); } if (sfx) { - CSfxManager::AddEmitter(water.GetSplashSound(factor), pos, zeus::skUp, true, false, 0x7f, - kInvalidAreaId); + CSfxManager::AddEmitter(water.GetSplashSound(factor), pos, zeus::skUp, true, false, 0x7f, kInvalidAreaId); } } } diff --git a/Runtime/World/CGameArea.hpp b/Runtime/World/CGameArea.hpp index 9b7cd2869..557d9ca01 100644 --- a/Runtime/World/CGameArea.hpp +++ b/Runtime/World/CGameArea.hpp @@ -271,6 +271,7 @@ private: std::unique_ptr m_debugSphereModel; std::optional m_debugConeRes; std::unique_ptr m_debugConeModel; + public: explicit CGameArea(CInputStream& in, int idx, int mlvlVersion); explicit CGameArea(CAssetId mreaId); // Warmup constructor diff --git a/Runtime/World/CGameLight.hpp b/Runtime/World/CGameLight.hpp index 75ba9311d..12f2d591d 100644 --- a/Runtime/World/CGameLight.hpp +++ b/Runtime/World/CGameLight.hpp @@ -14,9 +14,9 @@ class CGameLight : public CActor { u32 x140_priority; float x144_lifeTime; - std::optional m_debugRes; std::unique_ptr m_debugModel; + public: DEFINE_ENTITY CGameLight(TUniqueId uid, TAreaId aid, bool active, std::string_view name, const zeus::CTransform& xf, diff --git a/Runtime/World/CHUDBillboardEffect.cpp b/Runtime/World/CHUDBillboardEffect.cpp index deb55abc5..8058fa6cb 100644 --- a/Runtime/World/CHUDBillboardEffect.cpp +++ b/Runtime/World/CHUDBillboardEffect.cpp @@ -15,10 +15,10 @@ u32 CHUDBillboardEffect::g_IndirectTexturedBillboardCount = 0; u32 CHUDBillboardEffect::g_BillboardCount = 0; CHUDBillboardEffect::CHUDBillboardEffect(const std::optional>& particle, - const std::optional>& electric, - TUniqueId uid, bool active, std::string_view name, float dist, - const zeus::CVector3f& scale0, const zeus::CColor& color, - const zeus::CVector3f& scale1, const zeus::CVector3f& translation) + const std::optional>& electric, TUniqueId uid, + bool active, std::string_view name, float dist, const zeus::CVector3f& scale0, + const zeus::CColor& color, const zeus::CVector3f& scale1, + const zeus::CVector3f& translation) : CEffect(uid, CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), active, name, zeus::CTransform()) { xec_translation = translation; xec_translation.y() += dist; diff --git a/Runtime/World/CHUDBillboardEffect.hpp b/Runtime/World/CHUDBillboardEffect.hpp index a7c55a32e..af398312b 100644 --- a/Runtime/World/CHUDBillboardEffect.hpp +++ b/Runtime/World/CHUDBillboardEffect.hpp @@ -32,9 +32,9 @@ class CHUDBillboardEffect : public CEffect { public: DEFINE_ENTITY CHUDBillboardEffect(const std::optional>& particle, - const std::optional>& electric, TUniqueId uid, - bool active, std::string_view name, float dist, const zeus::CVector3f& scale0, - const zeus::CColor& color, const zeus::CVector3f& scale1, const zeus::CVector3f& translation); + const std::optional>& electric, TUniqueId uid, bool active, + std::string_view name, float dist, const zeus::CVector3f& scale0, const zeus::CColor& color, + const zeus::CVector3f& scale1, const zeus::CVector3f& translation); ~CHUDBillboardEffect() override; void Accept(IVisitor& visitor) override; void Think(float dt, CStateManager& mgr) override; diff --git a/Runtime/World/CKnockBackController.cpp b/Runtime/World/CKnockBackController.cpp index ef3fb8338..f676b2ed1 100644 --- a/Runtime/World/CKnockBackController.cpp +++ b/Runtime/World/CKnockBackController.cpp @@ -410,17 +410,17 @@ void CKnockBackController::ValidateState(const CPatterned& parent) { if (parent.GetBodyController()->HasBodyState(pas::EAnimationState::Hurled) && x80_availableStates.test(3) && x4_activeParms.x0_animState >= EKnockBackAnimationState::Hurled) { useState = EKnockBackAnimationState::Hurled; - } else if (parent.GetBodyController()->HasBodyState(pas::EAnimationState::KnockBack) && x80_availableStates.test(2) && - x4_activeParms.x0_animState >= EKnockBackAnimationState::KnockBack) { + } else if (parent.GetBodyController()->HasBodyState(pas::EAnimationState::KnockBack) && + x80_availableStates.test(2) && x4_activeParms.x0_animState >= EKnockBackAnimationState::KnockBack) { useState = EKnockBackAnimationState::KnockBack; } else if (parent.GetBodyController()->HasBodyState(pas::EAnimationState::AdditiveFlinch) && x80_availableStates.test(1) && x4_activeParms.x0_animState >= EKnockBackAnimationState::Flinch) { useState = EKnockBackAnimationState::Flinch; } } else if (parent.GetBodyController()->HasBodyState(pas::EAnimationState::Fall) && x80_availableStates.test(4) && - (x4_activeParms.x0_animState >= EKnockBackAnimationState::Fall || - (!parent.GetBodyController()->HasBodyState(pas::EAnimationState::Hurled) && - x4_activeParms.x0_animState >= EKnockBackAnimationState::Hurled))) { + (x4_activeParms.x0_animState >= EKnockBackAnimationState::Fall || + (!parent.GetBodyController()->HasBodyState(pas::EAnimationState::Hurled) && + x4_activeParms.x0_animState >= EKnockBackAnimationState::Hurled))) { useState = EKnockBackAnimationState::Fall; } else if (parent.GetBodyController()->HasBodyState(pas::EAnimationState::Hurled) && x80_availableStates.test(3) && x4_activeParms.x0_animState >= EKnockBackAnimationState::Hurled) { diff --git a/Runtime/World/CLightParameters.hpp b/Runtime/World/CLightParameters.hpp index f7d1daa7c..20395256c 100644 --- a/Runtime/World/CLightParameters.hpp +++ b/Runtime/World/CLightParameters.hpp @@ -14,7 +14,7 @@ class CLightParameters { friend class CActor; public: - enum class EShadowTesselation { Invalid=-1, Zero }; + enum class EShadowTesselation { Invalid = -1, Zero }; enum class EWorldLightingOptions { Zero, NormalWorld, NoShadowCast, DisableWorld }; diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index bf2504bba..fcb22ba7a 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -1,136 +1,136 @@ set(WORLD_SOURCES - CWorld.hpp CWorld.cpp - CWorldLight.hpp CWorldLight.cpp - IGameArea.hpp IGameArea.cpp - CGameArea.hpp CGameArea.cpp - CPlayer.hpp CPlayer.cpp - CPlayerEnergyDrain.hpp CPlayerEnergyDrain.cpp - CEnergyDrainSource.hpp CEnergyDrainSource.cpp - CPlayerCameraBob.hpp CPlayerCameraBob.cpp - CScriptCameraShaker.hpp CScriptCameraShaker.cpp - CMorphBall.hpp CMorphBall.cpp - CMorphBallShadow.hpp CMorphBallShadow.cpp - CActor.hpp CActor.cpp - CAi.hpp CAi.cpp - CAiFuncMap.hpp CAiFuncMap.cpp - CStateMachine.hpp CStateMachine.cpp - CPatterned.hpp CPatterned.cpp - CKnockBackController.hpp CKnockBackController.cpp - CPathFindArea.hpp CPathFindArea.cpp - CPathFindRegion.hpp CPathFindRegion.cpp - CPathFindSearch.hpp CPathFindSearch.cpp - CPathFindSpline.cpp - CPhysicsActor.hpp CPhysicsActor.cpp - CEntity.hpp CEntity.cpp - CPhysicsActor.hpp CPhysicsActor.cpp - CWorldTransManager.hpp CWorldTransManager.cpp - CEnvFxManager.hpp CEnvFxManager.cpp - CActorModelParticles.hpp CActorModelParticles.cpp - CTeamAiTypes.hpp - ScriptObjectSupport.hpp ScriptObjectSupport.cpp - ScriptLoader.hpp ScriptLoader.cpp - CScriptActor.hpp CScriptActor.cpp - CScriptWaypoint.hpp CScriptWaypoint.cpp - CScriptDoor.hpp CScriptDoor.cpp - CScriptTrigger.hpp CScriptTrigger.cpp - CScriptTimer.hpp CScriptTimer.cpp - CScriptCounter.hpp CScriptCounter.cpp - CScriptEffect.hpp CScriptEffect.cpp - CScriptSteam.hpp CScriptSteam.cpp - CScriptRipple.hpp CScriptRipple.cpp - CScriptBallTrigger.hpp CScriptBallTrigger.cpp - CScriptPlatform.hpp CScriptPlatform.cpp - CScriptSound.hpp CScriptSound.cpp - CScriptGenerator.hpp CScriptGenerator.cpp - CScriptDock.hpp CScriptDock.cpp - CScriptActorKeyframe.hpp CScriptActorKeyframe.cpp - CScriptWater.hpp CScriptWater.cpp - CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp - CScriptSpiderBallAttractionSurface.hpp CScriptSpiderBallAttractionSurface.cpp - CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp - CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp - CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp - CScriptVisorFlare.hpp CScriptVisorFlare.cpp - CScriptWorldTeleporter.hpp CScriptWorldTeleporter.cpp - CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp - CScriptCoverPoint.hpp CScriptCoverPoint.cpp - CScriptSpiderBallWaypoint.hpp CScriptSpiderBallWaypoint.cpp - CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp - CScriptCameraHint.hpp CScriptCameraHint.cpp - CScriptPickup.hpp CScriptPickup.cpp - CScriptMemoryRelay.hpp CScriptMemoryRelay.cpp - CScriptRandomRelay.hpp CScriptRandomRelay.cpp - CScriptRelay.hpp CScriptRelay.cpp - CScriptHUDMemo.hpp CScriptHUDMemo.cpp - CScriptCameraFilterKeyframe.hpp CScriptCameraFilterKeyframe.cpp - CScriptCameraBlurKeyframe.hpp CScriptCameraBlurKeyframe.cpp - CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp - CScriptDebris.hpp CScriptDebris.cpp - CScriptDebugCameraWaypoint.hpp CScriptDebugCameraWaypoint.cpp - CScriptDistanceFog.hpp CScriptDistanceFog.cpp - CScriptDockAreaChange.hpp CScriptDockAreaChange.cpp - CScriptActorRotate.hpp CScriptActorRotate.cpp - CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp - CScriptPlayerHint.hpp CScriptPlayerHint.cpp - CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp - CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp - CScriptEMPulse.hpp CScriptEMPulse.cpp - CScriptPlayerActor.hpp CScriptPlayerActor.cpp - CFishCloud.hpp CFishCloud.cpp - CFishCloudModifier.hpp CFishCloudModifier.cpp - CScriptSwitch.hpp CScriptSwitch.cpp - CWallWalker.hpp CWallWalker.cpp - CWallCrawlerSwarm.hpp CWallCrawlerSwarm.cpp - CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp - CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp - CScriptColorModulate.hpp CScriptColorModulate.cpp - CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp - CScriptMidi.hpp CScriptMidi.cpp - CRepulsor.hpp CRepulsor.cpp - CScriptGunTurret.hpp CScriptGunTurret.cpp - CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp - CTeamAiMgr.hpp CTeamAiMgr.cpp - CSnakeWeedSwarm.hpp CSnakeWeedSwarm.cpp - CScriptSpindleCamera.hpp CScriptSpindleCamera.cpp - CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp - CAmbientAI.hpp CAmbientAI.cpp - CScriptBeam.hpp CScriptBeam.cpp - CScriptMazeNode.hpp CScriptMazeNode.cpp - CScriptShadowProjector.hpp CScriptShadowProjector.cpp - CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp - CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp - CScriptControllerAction.hpp CScriptControllerAction.cpp - CVisorFlare.hpp CVisorFlare.cpp - CScriptVisorGoo.hpp CScriptVisorGoo.cpp - CGrappleParameters.hpp - CActorParameters.hpp - CLightParameters.hpp - CScannableParameters.hpp - CVisorParameters.hpp - CAnimationParameters.hpp - CDamageInfo.hpp CDamageInfo.cpp - CDamageVulnerability.hpp CDamageVulnerability.cpp - CFluidPlaneManager.hpp CFluidPlaneManager.cpp - CFluidUVMotion.hpp CFluidUVMotion.cpp - CPatternedInfo.hpp CPatternedInfo.cpp - CHealthInfo.hpp CHealthInfo.cpp - CPatterned.hpp CPatterned.cpp - CHUDMemoParms.hpp - CWorldShadow.hpp CWorldShadow.cpp - CProjectedShadow.hpp CProjectedShadow.cpp - CGameLight.hpp CGameLight.cpp - CFluidPlane.hpp CFluidPlane.cpp - CFluidPlaneCPU.hpp CFluidPlaneCPU.cpp - CFluidPlaneGPU.hpp CFluidPlaneGPU.cpp - CFluidPlaneDoor.hpp CFluidPlaneDoor.cpp - CRippleManager.hpp CRippleManager.cpp - CRipple.hpp CRipple.cpp - CDestroyableRock.hpp CDestroyableRock.cpp - CEffect.hpp CEffect.cpp - CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp - CExplosion.hpp CExplosion.cpp - CIceImpact.hpp CIceImpact.cpp - CFire.hpp CFire.cpp - CEntityInfo.hpp) + CWorld.hpp CWorld.cpp + CWorldLight.hpp CWorldLight.cpp + IGameArea.hpp IGameArea.cpp + CGameArea.hpp CGameArea.cpp + CPlayer.hpp CPlayer.cpp + CPlayerEnergyDrain.hpp CPlayerEnergyDrain.cpp + CEnergyDrainSource.hpp CEnergyDrainSource.cpp + CPlayerCameraBob.hpp CPlayerCameraBob.cpp + CScriptCameraShaker.hpp CScriptCameraShaker.cpp + CMorphBall.hpp CMorphBall.cpp + CMorphBallShadow.hpp CMorphBallShadow.cpp + CActor.hpp CActor.cpp + CAi.hpp CAi.cpp + CAiFuncMap.hpp CAiFuncMap.cpp + CStateMachine.hpp CStateMachine.cpp + CPatterned.hpp CPatterned.cpp + CKnockBackController.hpp CKnockBackController.cpp + CPathFindArea.hpp CPathFindArea.cpp + CPathFindRegion.hpp CPathFindRegion.cpp + CPathFindSearch.hpp CPathFindSearch.cpp + CPathFindSpline.cpp + CPhysicsActor.hpp CPhysicsActor.cpp + CEntity.hpp CEntity.cpp + CPhysicsActor.hpp CPhysicsActor.cpp + CWorldTransManager.hpp CWorldTransManager.cpp + CEnvFxManager.hpp CEnvFxManager.cpp + CActorModelParticles.hpp CActorModelParticles.cpp + CTeamAiTypes.hpp + ScriptObjectSupport.hpp ScriptObjectSupport.cpp + ScriptLoader.hpp ScriptLoader.cpp + CScriptActor.hpp CScriptActor.cpp + CScriptWaypoint.hpp CScriptWaypoint.cpp + CScriptDoor.hpp CScriptDoor.cpp + CScriptTrigger.hpp CScriptTrigger.cpp + CScriptTimer.hpp CScriptTimer.cpp + CScriptCounter.hpp CScriptCounter.cpp + CScriptEffect.hpp CScriptEffect.cpp + CScriptSteam.hpp CScriptSteam.cpp + CScriptRipple.hpp CScriptRipple.cpp + CScriptBallTrigger.hpp CScriptBallTrigger.cpp + CScriptPlatform.hpp CScriptPlatform.cpp + CScriptSound.hpp CScriptSound.cpp + CScriptGenerator.hpp CScriptGenerator.cpp + CScriptDock.hpp CScriptDock.cpp + CScriptActorKeyframe.hpp CScriptActorKeyframe.cpp + CScriptWater.hpp CScriptWater.cpp + CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp + CScriptSpiderBallAttractionSurface.hpp CScriptSpiderBallAttractionSurface.cpp + CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp + CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp + CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp + CScriptVisorFlare.hpp CScriptVisorFlare.cpp + CScriptWorldTeleporter.hpp CScriptWorldTeleporter.cpp + CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp + CScriptCoverPoint.hpp CScriptCoverPoint.cpp + CScriptSpiderBallWaypoint.hpp CScriptSpiderBallWaypoint.cpp + CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp + CScriptCameraHint.hpp CScriptCameraHint.cpp + CScriptPickup.hpp CScriptPickup.cpp + CScriptMemoryRelay.hpp CScriptMemoryRelay.cpp + CScriptRandomRelay.hpp CScriptRandomRelay.cpp + CScriptRelay.hpp CScriptRelay.cpp + CScriptHUDMemo.hpp CScriptHUDMemo.cpp + CScriptCameraFilterKeyframe.hpp CScriptCameraFilterKeyframe.cpp + CScriptCameraBlurKeyframe.hpp CScriptCameraBlurKeyframe.cpp + CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp + CScriptDebris.hpp CScriptDebris.cpp + CScriptDebugCameraWaypoint.hpp CScriptDebugCameraWaypoint.cpp + CScriptDistanceFog.hpp CScriptDistanceFog.cpp + CScriptDockAreaChange.hpp CScriptDockAreaChange.cpp + CScriptActorRotate.hpp CScriptActorRotate.cpp + CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp + CScriptPlayerHint.hpp CScriptPlayerHint.cpp + CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp + CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp + CScriptEMPulse.hpp CScriptEMPulse.cpp + CScriptPlayerActor.hpp CScriptPlayerActor.cpp + CFishCloud.hpp CFishCloud.cpp + CFishCloudModifier.hpp CFishCloudModifier.cpp + CScriptSwitch.hpp CScriptSwitch.cpp + CWallWalker.hpp CWallWalker.cpp + CWallCrawlerSwarm.hpp CWallCrawlerSwarm.cpp + CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp + CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp + CScriptColorModulate.hpp CScriptColorModulate.cpp + CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp + CScriptMidi.hpp CScriptMidi.cpp + CRepulsor.hpp CRepulsor.cpp + CScriptGunTurret.hpp CScriptGunTurret.cpp + CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp + CTeamAiMgr.hpp CTeamAiMgr.cpp + CSnakeWeedSwarm.hpp CSnakeWeedSwarm.cpp + CScriptSpindleCamera.hpp CScriptSpindleCamera.cpp + CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp + CAmbientAI.hpp CAmbientAI.cpp + CScriptBeam.hpp CScriptBeam.cpp + CScriptMazeNode.hpp CScriptMazeNode.cpp + CScriptShadowProjector.hpp CScriptShadowProjector.cpp + CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp + CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp + CScriptControllerAction.hpp CScriptControllerAction.cpp + CVisorFlare.hpp CVisorFlare.cpp + CScriptVisorGoo.hpp CScriptVisorGoo.cpp + CGrappleParameters.hpp + CActorParameters.hpp + CLightParameters.hpp + CScannableParameters.hpp + CVisorParameters.hpp + CAnimationParameters.hpp + CDamageInfo.hpp CDamageInfo.cpp + CDamageVulnerability.hpp CDamageVulnerability.cpp + CFluidPlaneManager.hpp CFluidPlaneManager.cpp + CFluidUVMotion.hpp CFluidUVMotion.cpp + CPatternedInfo.hpp CPatternedInfo.cpp + CHealthInfo.hpp CHealthInfo.cpp + CPatterned.hpp CPatterned.cpp + CHUDMemoParms.hpp + CWorldShadow.hpp CWorldShadow.cpp + CProjectedShadow.hpp CProjectedShadow.cpp + CGameLight.hpp CGameLight.cpp + CFluidPlane.hpp CFluidPlane.cpp + CFluidPlaneCPU.hpp CFluidPlaneCPU.cpp + CFluidPlaneGPU.hpp CFluidPlaneGPU.cpp + CFluidPlaneDoor.hpp CFluidPlaneDoor.cpp + CRippleManager.hpp CRippleManager.cpp + CRipple.hpp CRipple.cpp + CDestroyableRock.hpp CDestroyableRock.cpp + CEffect.hpp CEffect.cpp + CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp + CExplosion.hpp CExplosion.cpp + CIceImpact.hpp CIceImpact.cpp + CFire.hpp CFire.cpp + CEntityInfo.hpp) runtime_add_list(World WORLD_SOURCES) diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index 131852a14..7f6391476 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -26,7 +26,7 @@ void CPFAreaOctree::Fixup(CPFArea& area) { return; } - for (auto & ptr : x28_children) { + for (auto& ptr : x28_children) { if ((reinterpret_cast(ptr) & 0x80000000) == 0) ptr = &area.x158_octree[reinterpret_cast(ptr)]; else diff --git a/Runtime/World/CPathFindArea.hpp b/Runtime/World/CPathFindArea.hpp index f96081bd4..5a58bc61f 100644 --- a/Runtime/World/CPathFindArea.hpp +++ b/Runtime/World/CPathFindArea.hpp @@ -31,7 +31,7 @@ class CPFAreaOctree { u32 x0_isLeaf; zeus::CAABox x4_aabb; zeus::CVector3f x1c_center; - std::array x28_children {}; + std::array x28_children{}; rstl::prereserved_vector x48_regions; public: diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index b7b25ca94..5e3dc9d11 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -192,9 +192,7 @@ public: void SetNumTicksPartialUpdate(u32 ticks) { x250_numTicksPartialUpdate = ticks; } u32 GetNumTicksStuck() const { return x24c_numTicksStuck; } void SetNumTicksStuck(u32 ticks) { x24c_numTicksStuck = ticks; } - const std::optional& GetLastFloorPlaneNormal() const { - return x228_lastFloorPlaneNormal; - } + const std::optional& GetLastFloorPlaneNormal() const { return x228_lastFloorPlaneNormal; } void SetLastFloorPlaneNormal(const std::optional& normal) { x228_lastFloorPlaneNormal = normal; } CMotionState PredictMotion_Internal(float) const; @@ -208,6 +206,8 @@ public: void ApplyTorqueWR(const zeus::CVector3f& torque); void UseCollisionImpulses(); - static constexpr float GravityConstant() { return 9.81f * 2.5f; } /* 9.81 m/s ^ 2 is normal acceleration under earth gravity, Tallon 4 is 2.5 times that */ + static constexpr float GravityConstant() { + return 9.81f * 2.5f; + } /* 9.81 m/s ^ 2 is normal acceleration under earth gravity, Tallon 4 is 2.5 times that */ }; } // namespace metaforce diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 0944f54b7..a8cb1b36c 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -1307,8 +1307,8 @@ void CPlayer::FinishNewScan(CStateManager& mgr) { } const auto scanCompletion = mgr.CalculateScanCompletionRate(); - const CAssetId message = UpdatePersistentScanPercent(mgr.GetPlayerState()->GetLogScans(), scanCompletion.first, - scanCompletion.second); + const CAssetId message = + UpdatePersistentScanPercent(mgr.GetPlayerState()->GetLogScans(), scanCompletion.first, scanCompletion.second); if (message.IsValid()) { mgr.ShowPausedHUDMemo(message, 0.f); } @@ -1472,7 +1472,8 @@ void CPlayer::Render(CStateManager& mgr) { const auto mdsp1 = int(x730_transitionModels.size() + 1); for (int i = 0; i < x730_transitionModels.size(); ++i) { const int ni = i + 1; - const float alpha = transitionAlpha * (1.f - (ni + 1) / float(mdsp1)) * *x71c_transitionModelAlphas.GetEntry(ni); + const float alpha = + transitionAlpha * (1.f - (ni + 1) / float(mdsp1)) * *x71c_transitionModelAlphas.GetEntry(ni); if (alpha != 0.f) { CModelData& data = *x730_transitionModels[i]; CModelFlags flags(5, 0, 3, zeus::CColor(1.f, alpha)); @@ -1963,7 +1964,8 @@ void CPlayer::CalculatePlayerControlDirection(CStateManager& mgr) { x540_controlDir = x54c_controlDirFlat = zeus::skForward; } } else { - const zeus::CVector3f camToPlayer = GetTranslation() - mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation(); + const zeus::CVector3f camToPlayer = + GetTranslation() - mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation(); if (!camToPlayer.canBeNormalized()) { x540_controlDir = x54c_controlDirFlat = zeus::skForward; } else { @@ -3442,7 +3444,8 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f if (playerToSwingLow.canBeNormalized()) { const float distToSwingLow = playerToSwingLow.magnitude(); playerToSwingLow.normalize(); - const float timeToLow = zeus::clamp(-1.f, distToSwingLow / g_tweakPlayer->GetGrapplePullSpeedProportion(), 1.f); + const float timeToLow = + zeus::clamp(-1.f, distToSwingLow / g_tweakPlayer->GetGrapplePullSpeedProportion(), 1.f); const float pullSpeed = timeToLow * (g_tweakPlayer->GetGrapplePullSpeedMax() - g_tweakPlayer->GetGrapplePullSpeedMin()) + g_tweakPlayer->GetGrapplePullSpeedMin(); @@ -4240,8 +4243,8 @@ const zeus::CTransform& CPlayer::GetFirstPersonCameraTransform(const CStateManag return mgr.GetCameraManager()->GetFirstPersonCamera()->GetGunFollowTransform(); } -TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const EntityList& list, - EPlayerZoneInfo info, EPlayerZoneType zone, CStateManager& mgr) const { +TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const EntityList& list, EPlayerZoneInfo info, EPlayerZoneType zone, + CStateManager& mgr) const { const zeus::CVector3f eyePos = GetEyePosition(); float minEyeToAimMag = 10000.f; float minPosInBoxMagSq = 10000.f; @@ -4257,7 +4260,8 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const EntityList& list, if (act->GetUniqueId() != GetUniqueId() && ValidateObjectForMode(act->GetUniqueId(), mgr)) { const zeus::CVector3f aimPos = act->GetAimPosition(mgr, 0.f); const zeus::CVector3f screenPos = fpCam->ConvertToScreenSpace(aimPos); - const zeus::CVector3f posInBox(vpWHalf + screenPos.x() * vpWHalf, vpHHalf + screenPos.y() * vpHHalf, screenPos.z()); + const zeus::CVector3f posInBox(vpWHalf + screenPos.x() * vpWHalf, vpHHalf + screenPos.y() * vpHHalf, + screenPos.z()); if (WithinOrbitScreenBox(posInBox, info, zone)) { zeus::CVector3f eyeToAim = aimPos - eyePos; const float eyeToAimMag = eyeToAim.magnitude(); @@ -4478,9 +4482,8 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, EP return bestId; } -void CPlayer::FindOrbitableObjects(const EntityList& nearObjects, - std::vector& listOut, EPlayerZoneInfo zone, EPlayerZoneType type, - CStateManager& mgr, bool onScreenTest) const { +void CPlayer::FindOrbitableObjects(const EntityList& nearObjects, std::vector& listOut, EPlayerZoneInfo zone, + EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const { const CFirstPersonCamera* fpCam = mgr.GetCameraManager()->GetFirstPersonCamera(); const zeus::CVector3f eyePos = GetEyePosition(); @@ -4948,7 +4951,8 @@ CPlayer::EOrbitValidationResult CPlayer::ValidateOrbitTargetId(TUniqueId uid, CS eyeToOrbitFlat.z() = 0.f; if (eyeToOrbitFlat.canBeNormalized() && eyeToOrbitFlat.magnitude() > 1.f) { - const float angleFromHorizon = std::asin(zeus::clamp(-1.f, std::fabs(eyeToOrbit.z()) / eyeToOrbit.magnitude(), 1.f)); + const float angleFromHorizon = + std::asin(zeus::clamp(-1.f, std::fabs(eyeToOrbit.z()) / eyeToOrbit.magnitude(), 1.f)); if ((eyeToOrbit.z() >= 0.f && angleFromHorizon >= g_tweakPlayer->GetOrbitUpperAngle()) || (eyeToOrbit.z() < 0.f && angleFromHorizon >= g_tweakPlayer->GetOrbitLowerAngle())) { return EOrbitValidationResult::ExtremeHorizonAngle; diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index d1a08cf8b..23405b5a0 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -485,13 +485,13 @@ public: bool ValidateObjectForMode(TUniqueId uid, CStateManager& mgr) const; TUniqueId FindAimTargetId(CStateManager& mgr) const; TUniqueId GetAimTarget() const { return x3f4_aimTarget; } - TUniqueId CheckEnemiesAgainstOrbitZone(const EntityList& list, EPlayerZoneInfo info, - EPlayerZoneType zone, CStateManager& mgr) const; + TUniqueId CheckEnemiesAgainstOrbitZone(const EntityList& list, EPlayerZoneInfo info, EPlayerZoneType zone, + CStateManager& mgr) const; TUniqueId FindOrbitTargetId(CStateManager& mgr) const; void UpdateOrbitableObjects(CStateManager& mgr); TUniqueId FindBestOrbitableObject(const std::vector& ids, EPlayerZoneInfo info, CStateManager& mgr) const; - void FindOrbitableObjects(const EntityList& nearObjects, std::vector& listOut, - EPlayerZoneInfo zone, EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const; + void FindOrbitableObjects(const EntityList& nearObjects, std::vector& listOut, EPlayerZoneInfo zone, + EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const; bool WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone, EPlayerZoneType type) const; bool WithinOrbitScreenEllipse(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone) const; bool CheckOrbitDisableSourceList(CStateManager& mgr); diff --git a/Runtime/World/CScriptCameraHintTrigger.cpp b/Runtime/World/CScriptCameraHintTrigger.cpp index 646329a85..1976617bd 100644 --- a/Runtime/World/CScriptCameraHintTrigger.cpp +++ b/Runtime/World/CScriptCameraHintTrigger.cpp @@ -56,8 +56,6 @@ void CScriptCameraHintTrigger::Touch(CActor& other, CStateManager& mgr) { } } -std::optional CScriptCameraHintTrigger::GetTouchBounds() const { - return {xe8_obb.calculateAABox()}; -} +std::optional CScriptCameraHintTrigger::GetTouchBounds() const { return {xe8_obb.calculateAABox()}; } } // namespace metaforce diff --git a/Runtime/World/CScriptCameraHintTrigger.hpp b/Runtime/World/CScriptCameraHintTrigger.hpp index 1b0b73a05..9ae59f300 100644 --- a/Runtime/World/CScriptCameraHintTrigger.hpp +++ b/Runtime/World/CScriptCameraHintTrigger.hpp @@ -19,9 +19,8 @@ class CScriptCameraHintTrigger : public CActor { public: DEFINE_ENTITY - CScriptCameraHintTrigger(TUniqueId uid, bool active, std::string_view name, - const CEntityInfo& info, const zeus::CVector3f& scale, - const zeus::CTransform& xf, bool deactivateOnEnter, + CScriptCameraHintTrigger(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, + const zeus::CVector3f& scale, const zeus::CTransform& xf, bool deactivateOnEnter, bool deactivateOnExit); void Accept(IVisitor& visitor) override; diff --git a/Runtime/World/CScriptDamageableTrigger.cpp b/Runtime/World/CScriptDamageableTrigger.cpp index 07bd9e407..448bfa52d 100644 --- a/Runtime/World/CScriptDamageableTrigger.cpp +++ b/Runtime/World/CScriptDamageableTrigger.cpp @@ -8,7 +8,8 @@ #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce { -static CActorParameters MakeDamageableTriggerActorParms(const CActorParameters& aParams, const CVisorParameters& vParams) { +static CActorParameters MakeDamageableTriggerActorParms(const CActorParameters& aParams, + const CVisorParameters& vParams) { CActorParameters ret = aParams; ret.SetVisorParameters(vParams); return ret; @@ -113,8 +114,8 @@ void CScriptDamageableTrigger::Render(CStateManager& mgr) { if (x30_24_active && x1dc_faceFlag != 0 && std::fabs(x1e0_alpha) >= 0.00001f) { const zeus::CAABox aabb = x14c_bounds.getTransformedAABox(x214_faceDirInv); const zeus::CTransform xf = x34_transform * zeus::CTransform::Translate(x244_faceTranslate) * x1e4_faceDir; - x254_fluidPlane.Render(mgr, x1e0_alpha, aabb, xf, zeus::CTransform(), false, xe8_frustum, {}, - kInvalidUniqueId, nullptr, 0, 0, zeus::skZero3f); + x254_fluidPlane.Render(mgr, x1e0_alpha, aabb, xf, zeus::CTransform(), false, xe8_frustum, {}, kInvalidUniqueId, + nullptr, 0, 0, zeus::skZero3f); } CActor::Render(mgr); diff --git a/Runtime/World/CScriptDoor.hpp b/Runtime/World/CScriptDoor.hpp index 60388efde..0af95edf3 100644 --- a/Runtime/World/CScriptDoor.hpp +++ b/Runtime/World/CScriptDoor.hpp @@ -17,11 +17,7 @@ public: Ready, }; - enum class EDoorOpenCondition { - NotReady, - Loading, - Ready - }; + enum class EDoorOpenCondition { NotReady, Loading, Ready }; float x258_animLen; float x25c_animTime = 0.f; diff --git a/Runtime/World/CScriptEffect.cpp b/Runtime/World/CScriptEffect.cpp index eb69f62a3..a5ae76028 100644 --- a/Runtime/World/CScriptEffect.cpp +++ b/Runtime/World/CScriptEffect.cpp @@ -240,8 +240,8 @@ void CScriptEffect::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& if (visible && x138_actorLights) { const CGameArea* area = mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways()); - x138_actorLights->BuildAreaLightList( - mgr, *area, zeus::CAABox{x9c_renderBounds.center(), x9c_renderBounds.center()}); + x138_actorLights->BuildAreaLightList(mgr, *area, + zeus::CAABox{x9c_renderBounds.center(), x9c_renderBounds.center()}); x138_actorLights->BuildDynamicLightList(mgr, x9c_renderBounds); } EnsureRendered(mgr); diff --git a/Runtime/World/CScriptGrapplePoint.cpp b/Runtime/World/CScriptGrapplePoint.cpp index 639f7bd53..46c577d77 100644 --- a/Runtime/World/CScriptGrapplePoint.cpp +++ b/Runtime/World/CScriptGrapplePoint.cpp @@ -46,8 +46,6 @@ void CScriptGrapplePoint::Render(CStateManager&) { std::optional CScriptGrapplePoint::GetTouchBounds() const { return {xe8_touchBounds}; } -void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, CStateManager& mgr) { - CActor::EnsureRendered(mgr); -} +void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, CStateManager& mgr) { CActor::EnsureRendered(mgr); } } // namespace metaforce diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index 337a98b29..46038af36 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -341,8 +341,8 @@ void CScriptGunTurret::Touch(CActor& act, CStateManager& mgr) { dVuln->WeaponHits(CWeaponMode::Ice(), false)) { x560_25_frozen = true; SendScriptMsgs(EScriptObjectState::Zero, mgr, EScriptObjectMessage::None); - x53c_freezeRemTime = mgr.GetActiveRandom()->Float() * - x2d4_data.GetFreezeVariance() + x2d4_data.GetFreezeDuration(); + x53c_freezeRemTime = + mgr.GetActiveRandom()->Float() * x2d4_data.GetFreezeVariance() + x2d4_data.GetFreezeDuration(); SetMuted(true); } SendScriptMsgs(EScriptObjectState::Damage, mgr, EScriptObjectMessage::None); @@ -377,15 +377,17 @@ void CScriptGunTurret::SetupCollisionManager(CStateManager& mgr) { x508_gunSDKSeg, blastLCTR, 0.6f, 1.f, CJointCollisionDescription::EOrientationType::One, "Gun_SDK"sv, 1000.f)); jointDescs.push_back(CJointCollisionDescription::SphereCollision(blastLCTR, 0.3f, "Blast_LCTR"sv, 1000.f)); - x49c_collisionManager = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), jointDescs, true); + x49c_collisionManager = + std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), jointDescs, true); x49c_collisionManager->SetActive(mgr, GetActive()); for (int i = 0; i < x49c_collisionManager->GetNumCollisionActors(); ++i) { const auto& desc = x49c_collisionManager->GetCollisionDescFromIndex(i); if (const TCastToPtr cAct = mgr.ObjectById(desc.GetCollisionActorId())) { cAct->AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr); - cAct->SetMaterialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Player}, - {EMaterialTypes::Character, EMaterialTypes::NoStaticCollision, EMaterialTypes::NoPlatformCollision})); + cAct->SetMaterialFilter(CMaterialFilter::MakeIncludeExclude( + {EMaterialTypes::Player}, + {EMaterialTypes::Character, EMaterialTypes::NoStaticCollision, EMaterialTypes::NoPlatformCollision})); if (desc.GetName().find("Blast_LCTR"sv) != std::string_view::npos) { x4a0_collisionActor = desc.GetCollisionActorId(); } @@ -790,8 +792,8 @@ void CScriptGunTurret::ProcessInactiveState(EStateMsg msg, CStateManager& mgr, f if (const TCastToPtr gun = mgr.ObjectById(x25c_gunId)) { forceActivate = gun->HealthInfo(mgr)->GetHP() < x260_lastGunHP; } - if (x2d4_data.GetScriptedStartOnly() ? (forceActivate || x560_29_scriptedStart) : - (forceActivate || x560_29_scriptedStart || InDetectionRange(mgr))) { + if (x2d4_data.GetScriptedStartOnly() ? (forceActivate || x560_29_scriptedStart) + : (forceActivate || x560_29_scriptedStart || InDetectionRange(mgr))) { x528_curInactiveTime += dt; if (forceActivate || x528_curInactiveTime >= x2d4_data.GetIntoActivateDelay()) SetTurretState(ETurretState::Ready, mgr); @@ -866,9 +868,8 @@ void CScriptGunTurret::ProcessTargettingState(EStateMsg msg, CStateManager& mgr, mgr.GetPlayer(), false, dt); } - zeus::CVector3f compensated = - x3a4_burstFire.GetDistanceCompensatedError( - (x404_targetPosition - gun->GetTranslation()).magnitude(), 20.f); + zeus::CVector3f compensated = x3a4_burstFire.GetDistanceCompensatedError( + (x404_targetPosition - gun->GetTranslation()).magnitude(), 20.f); compensated = gun->GetTransform().rotate(compensated); @@ -910,7 +911,7 @@ void CScriptGunTurret::ProcessExitTargettingState(EStateMsg msg, CStateManager& return; if (TCastToPtr gun = mgr.ObjectById(x25c_gunId)) { - //zeus::CTransform gunXf = GetTransform() * GetLocatorTransform("Gun_SDK"sv); + // zeus::CTransform gunXf = GetTransform() * GetLocatorTransform("Gun_SDK"sv); if (zeus::CVector3f::getAngleDiff(gun->GetTransform().frontVector(), x544_originalFrontVec) < zeus::degToRad(0.9f)) SetTurretState(ETurretState::Ready, mgr); @@ -1073,8 +1074,7 @@ bool CScriptGunTurret::PlayerInsideTurretSphere(CStateManager& mgr) const { if (cAct->GetActive()) { zeus::CVector3f delta = mgr.GetPlayer().GetAimPosition(mgr, 0.f) - GetTranslation(); if (delta.z() < 0.f) { - const float rad = cAct->GetSphereRadius() * 2.f + - (cAct->GetTranslation() - GetTranslation()).magnitude(); + const float rad = cAct->GetSphereRadius() * 2.f + (cAct->GetTranslation() - GetTranslation()).magnitude(); return delta.magSquared() < rad * rad; } } @@ -1142,8 +1142,8 @@ void CScriptGunTurret::UpdateGunOrientation(float dt, CStateManager& mgr) { useYaw = -std::atan2(xf.frontVector().x(), xf.frontVector().y()); } - const float f28 = -0.5f * x2d4_data.GetDownMaxAngle() * - (1.f - std::cos(2.f * x524_curStateTime * x2d4_data.GetTurnSpeed())); + const float f28 = + -0.5f * x2d4_data.GetDownMaxAngle() * (1.f - std::cos(2.f * x524_curStateTime * x2d4_data.GetTurnSpeed())); const float pitch = gun->GetPitch(); const float f2 = f28 - pitch; const float f31 = x2d4_data.GetTurnSpeed() * dt; diff --git a/Runtime/World/CScriptMazeNode.hpp b/Runtime/World/CScriptMazeNode.hpp index f596c7712..9c702a50d 100644 --- a/Runtime/World/CScriptMazeNode.hpp +++ b/Runtime/World/CScriptMazeNode.hpp @@ -55,7 +55,7 @@ class CMazeState { bool x94_24_initialized : 1 = false; std::vector m_path; - CLineRenderer m_renderer = {CLineRenderer::EPrimitiveMode::LineStrip, skMazeRows * skMazeCols, {}, true}; + CLineRenderer m_renderer = {CLineRenderer::EPrimitiveMode::LineStrip, skMazeRows* skMazeCols, {}, true}; public: CMazeState(s32 enterCol, s32 enterRow, s32 targetCol, s32 targetRow) diff --git a/Runtime/World/CScriptMemoryRelay.cpp b/Runtime/World/CScriptMemoryRelay.cpp index 523c99cad..dac14dcc0 100644 --- a/Runtime/World/CScriptMemoryRelay.cpp +++ b/Runtime/World/CScriptMemoryRelay.cpp @@ -7,8 +7,8 @@ namespace metaforce { -CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool defaultActive, - bool skipSendActive, bool ignoreMessages) +CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, + bool defaultActive, bool skipSendActive, bool ignoreMessages) : CEntity(uid, info, true, name) , x34_24_defaultActive(defaultActive) , x34_25_skipSendActive(skipSendActive) diff --git a/Runtime/World/CScriptPickup.cpp b/Runtime/World/CScriptPickup.cpp index ab846fd3b..ac5a5c9dd 100644 --- a/Runtime/World/CScriptPickup.cpp +++ b/Runtime/World/CScriptPickup.cpp @@ -98,8 +98,9 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) { x274_tractorTime += dt; posDelta = (20.f * (0.5f * zeus::min(2.f, x274_tractorTime))) * posDelta.normalized(); - if (x28c_26_enableTractorTest && (mgr.GetPlayer().GetPlayerGun()->IsCharging() ? - mgr.GetPlayer().GetPlayerGun()->GetChargeBeamFactor() : 0.f) < CPlayerGun::skTractorBeamFactor) { + if (x28c_26_enableTractorTest && + (mgr.GetPlayer().GetPlayerGun()->IsCharging() ? mgr.GetPlayer().GetPlayerGun()->GetChargeBeamFactor() : 0.f) < + CPlayerGun::skTractorBeamFactor) { x28c_26_enableTractorTest = false; x28c_25_inTractor = false; posDelta.zeroOut(); @@ -113,8 +114,8 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) { const zeus::CVector3f posDelta = GetTranslation() - mgr.GetCameraManager()->GetFirstPersonCamera()->GetTranslation(); const float relFov = zeus::CRelAngle(zeus::degToRad(g_tweakGame->GetFirstPersonFOV())).asRel(); - if (mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform(). - frontVector().dot(posDelta.normalized()) > std::cos(relFov) && + if (mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().frontVector().dot(posDelta.normalized()) > + std::cos(relFov) && posDelta.magSquared() < (30.f * 30.f)) { x28c_25_inTractor = true; x28c_26_enableTractorTest = true; diff --git a/Runtime/World/CScriptPickup.hpp b/Runtime/World/CScriptPickup.hpp index 56dd26658..890c0701d 100644 --- a/Runtime/World/CScriptPickup.hpp +++ b/Runtime/World/CScriptPickup.hpp @@ -27,8 +27,8 @@ public: DEFINE_ENTITY CScriptPickup(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& aParams, const zeus::CAABox& aabb, - CPlayerState::EItemType itemType, s32 amount, s32 capacity, CAssetId pickupEffect, - float possibility, float lifeTime, float fadeInTime, float startDelay, bool active); + CPlayerState::EItemType itemType, s32 amount, s32 capacity, CAssetId pickupEffect, float possibility, + float lifeTime, float fadeInTime, float startDelay, bool active); void Accept(IVisitor& visitor) override; void Think(float, CStateManager&) override; diff --git a/Runtime/World/CScriptPlatform.cpp b/Runtime/World/CScriptPlatform.cpp index f5eb67707..e92243ef6 100644 --- a/Runtime/World/CScriptPlatform.cpp +++ b/Runtime/World/CScriptPlatform.cpp @@ -204,8 +204,7 @@ void CScriptPlatform::MoveRiders(CStateManager& mgr, float dt, bool active, std: } } -EntityList -CScriptPlatform::BuildNearListFromRiders(CStateManager& mgr, const std::vector& movedRiders) { +EntityList CScriptPlatform::BuildNearListFromRiders(CStateManager& mgr, const std::vector& movedRiders) { EntityList ret; for (const SRiders& rider : movedRiders) { if (const TCastToConstPtr act = mgr.ObjectById(rider.x0_uid)) { diff --git a/Runtime/World/CScriptPlatform.hpp b/Runtime/World/CScriptPlatform.hpp index 691b23877..ca4b5bd80 100644 --- a/Runtime/World/CScriptPlatform.hpp +++ b/Runtime/World/CScriptPlatform.hpp @@ -64,24 +64,24 @@ class CScriptPlatform : public CPhysicsActor { void DragSlave(CStateManager& mgr, rstl::reserved_vector& draggedSet, CActor* actor, const zeus::CVector3f& delta); - void DragSlaves(CStateManager& mgr, rstl::reserved_vector& draggedSet, const zeus::CVector3f& delta); + void DragSlaves(CStateManager& mgr, rstl::reserved_vector& draggedSet, + const zeus::CVector3f& delta); static void DecayRiders(std::vector& riders, float dt, CStateManager& mgr); static void MoveRiders(CStateManager& mgr, float dt, bool active, std::vector& riders, std::vector& collidedRiders, const zeus::CTransform& oldXf, const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta, const zeus::CQuaternion& rotDelta); - static EntityList BuildNearListFromRiders(CStateManager& mgr, - const std::vector& movedRiders); + static EntityList BuildNearListFromRiders(CStateManager& mgr, const std::vector& movedRiders); std::optional m_boxFilter; + public: DEFINE_ENTITY CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float speed, bool detectCollision, float xrayAlpha, bool active, const CHealthInfo& hInfo, - const CDamageVulnerability& dVuln, - std::optional> dcln, bool rainSplashes, - u32 maxRainSplashes, u32 rainGenRate); + const CDamageVulnerability& dVuln, std::optional> dcln, + bool rainSplashes, u32 maxRainSplashes, u32 rainGenRate); void Accept(IVisitor& visitor) override; void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; diff --git a/Runtime/World/CScriptPlayerActor.cpp b/Runtime/World/CScriptPlayerActor.cpp index c917fad35..5367274e0 100644 --- a/Runtime/World/CScriptPlayerActor.cpp +++ b/Runtime/World/CScriptPlayerActor.cpp @@ -428,8 +428,8 @@ void CScriptPlayerActor::Render(CStateManager& mgr) { const float radius = zeus::clamp(0.25f, (6.f - vecFromCam.magnitude()) / 6.f, 2.f); const float offsetX = std::sin(x34c_phazonOffsetAngle); const float offsetY = std::sin(x34c_phazonOffsetAngle) * 0.5f; - //g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, 1.f), x338_phazonIndirectTexture, zeus::skWhite, - // radius, 0.05f, offsetX, offsetY); + // g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, 1.f), x338_phazonIndirectTexture, zeus::skWhite, + // radius, 0.05f, offsetX, offsetY); } } diff --git a/Runtime/World/CScriptRipple.cpp b/Runtime/World/CScriptRipple.cpp index a5e59a69f..7c260f743 100644 --- a/Runtime/World/CScriptRipple.cpp +++ b/Runtime/World/CScriptRipple.cpp @@ -35,6 +35,5 @@ void CScriptRipple::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt } } } - } } // namespace metaforce diff --git a/Runtime/World/CScriptRoomAcoustics.cpp b/Runtime/World/CScriptRoomAcoustics.cpp index 4f8b8d7e7..fdab609ed 100644 --- a/Runtime/World/CScriptRoomAcoustics.cpp +++ b/Runtime/World/CScriptRoomAcoustics.cpp @@ -59,7 +59,8 @@ void CScriptRoomAcoustics::EnableAuxCallbacks() { s_ActiveAcousticsAreaId = x4_areaId; } -void CScriptRoomAcoustics::Think(float dt, CStateManager& stateMgr) { /* Intentionally empty */ } +void CScriptRoomAcoustics::Think(float dt, CStateManager& stateMgr) { /* Intentionally empty */ +} void CScriptRoomAcoustics::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) { CEntity::AcceptScriptMsg(msg, objId, stateMgr); diff --git a/Runtime/World/CScriptSpawnPoint.cpp b/Runtime/World/CScriptSpawnPoint.cpp index 6dc2b9e42..51e428bcf 100644 --- a/Runtime/World/CScriptSpawnPoint.cpp +++ b/Runtime/World/CScriptSpawnPoint.cpp @@ -16,7 +16,7 @@ CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const , x34_xf(xf) , x64_itemCounts(itemCounts) , x10c_24_firstSpawn(defaultSpawn) -, x10c_25_morphed(morphed) { } +, x10c_25_morphed(morphed) {} void CScriptSpawnPoint::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index a14705d97..e83881a00 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -349,7 +349,8 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId if (aId != kInvalidAreaId) { worldLayerState = mgr.WorldLayerState(); } else { - const std::pair worldAreaPair = g_MemoryCardSys->GetAreaAndWorldIdForSaveId(x1bc_areaSaveId); + const std::pair worldAreaPair = + g_MemoryCardSys->GetAreaAndWorldIdForSaveId(x1bc_areaSaveId); if (worldAreaPair.first.IsValid()) { worldLayerState = g_GameState->StateForWorld(worldAreaPair.first).GetLayerState(); aId = worldAreaPair.second; @@ -529,7 +530,8 @@ void CScriptSpecialFunction::Render(CStateManager& mgr) { zeus::CVector3f max = GetTranslation() + x10c_vector3f; max.z() += z; const zeus::CAABox box(GetTranslation() - x10c_vector3f, max); - const zeus::CTransform modelMtx = zeus::CTransform::Translate(box.center()) * zeus::CTransform::Scale(box.extents()); + const zeus::CTransform modelMtx = + zeus::CTransform::Translate(box.center()) * zeus::CTransform::Scale(box.extents()); g_Renderer->SetModelMatrix(modelMtx); g_Renderer->RenderFogVolume(x118_color, zeus::CAABox(-1.f, 1.f), nullptr, nullptr); } diff --git a/Runtime/World/CScriptSpindleCamera.cpp b/Runtime/World/CScriptSpindleCamera.cpp index 8a6c98103..9a3becedd 100644 --- a/Runtime/World/CScriptSpindleCamera.cpp +++ b/Runtime/World/CScriptSpindleCamera.cpp @@ -30,24 +30,17 @@ SSpindleProperty::SSpindleProperty(CInputStream& in) { } } -CScriptSpindleCamera::CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info, - const zeus::CTransform& xf, bool active, u32 flags, float hintToCamDistMin, - float hintToCamDistMax, float hintToCamVOffMin, float hintToCamVOffMax, - const SSpindleProperty& targetHintToCamDeltaAngleVel, - const SSpindleProperty& deltaAngleScaleWithCamDist, - const SSpindleProperty& hintToCamDist, - const SSpindleProperty& distOffsetFromBallDist, - const SSpindleProperty& hintBallToCamAzimuth, - const SSpindleProperty& unused, - const SSpindleProperty& maxHintBallToCamAzimuth, - const SSpindleProperty& camLookRelAzimuth, - const SSpindleProperty& lookPosZOffset, - const SSpindleProperty& camPosZOffset, - const SSpindleProperty& clampedAzimuthFromHintDir, - const SSpindleProperty& dampingAzimuthSpeed, - const SSpindleProperty& targetHintToCamDeltaAngleVelRange, - const SSpindleProperty& deleteHintBallDist, - const SSpindleProperty& recoverClampedAzimuthFromHintDir) +CScriptSpindleCamera::CScriptSpindleCamera( + TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, bool active, u32 flags, + float hintToCamDistMin, float hintToCamDistMax, float hintToCamVOffMin, float hintToCamVOffMax, + const SSpindleProperty& targetHintToCamDeltaAngleVel, const SSpindleProperty& deltaAngleScaleWithCamDist, + const SSpindleProperty& hintToCamDist, const SSpindleProperty& distOffsetFromBallDist, + const SSpindleProperty& hintBallToCamAzimuth, const SSpindleProperty& unused, + const SSpindleProperty& maxHintBallToCamAzimuth, const SSpindleProperty& camLookRelAzimuth, + const SSpindleProperty& lookPosZOffset, const SSpindleProperty& camPosZOffset, + const SSpindleProperty& clampedAzimuthFromHintDir, const SSpindleProperty& dampingAzimuthSpeed, + const SSpindleProperty& targetHintToCamDeltaAngleVelRange, const SSpindleProperty& deleteHintBallDist, + const SSpindleProperty& recoverClampedAzimuthFromHintDir) : CGameCamera(uid, active, name, info, xf, CCameraManager::ThirdPersonFOV(), CCameraManager::NearPlane(), CCameraManager::FarPlane(), CCameraManager::Aspect(), kInvalidUniqueId, false, 0) , x188_flags(flags) @@ -153,27 +146,26 @@ void CScriptSpindleCamera::Think(float dt, CStateManager& mgr) { } x18c_inVars.clear(); - x18c_inVars.push_back(0.f); // Zero - x18c_inVars.push_back(hintToBallDist); // HintToBallDist + x18c_inVars.push_back(0.f); // Zero + x18c_inVars.push_back(hintToBallDist); // HintToBallDist x18c_inVars.push_back(std::fabs(hintToBallVOff)); // HintToBallVOff const float hintBallAngle = std::fabs(std::acos(zeus::clamp(-1.f, hintToBallDir.dot(hintDir), 1.f))); x18c_inVars.push_back(hintBallAngle); // HintBallAngle const float hintBallCross = hintToBallDir.toVec2f().cross(hintDir.toVec2f()); if (hintBallCross >= 0.f) { - x18c_inVars.push_back(hintBallAngle); // HintBallRightAngle + x18c_inVars.push_back(hintBallAngle); // HintBallRightAngle x18c_inVars.push_back(2.f * M_PIF - hintBallAngle); // HintBallLeftAngle } else { x18c_inVars.push_back(2.f * M_PIF - hintBallAngle); // HintBallRightAngle - x18c_inVars.push_back(hintBallAngle); // HintBallLeftAngle + x18c_inVars.push_back(hintBallAngle); // HintBallLeftAngle } zeus::CVector3f hintDelta = hint->GetTranslation() - hint->GetOriginalTransform().origin; const float hintDeltaVOff = std::fabs(hintDelta.z()); hintDelta.z() = 0.f; x18c_inVars.push_back(hintDelta.canBeNormalized() ? hintDelta.magnitude() : 0.f); // HintDeltaDist - x18c_inVars.push_back(hintDeltaVOff); // HintDeltaVOff + x18c_inVars.push_back(hintDeltaVOff); // HintDeltaVOff - if ((x188_flags & 0x2000) && hintToBallDist > - x2f8_deleteHintBallDist.GetValue(GetInVar(x2f8_deleteHintBallDist))) { + if ((x188_flags & 0x2000) && hintToBallDist > x2f8_deleteHintBallDist.GetValue(GetInVar(x2f8_deleteHintBallDist))) { if (hint->GetDelegatedCamera() == GetUniqueId()) { mgr.GetCameraManager()->DeleteCameraHint(hint->GetUniqueId(), mgr); @@ -190,8 +182,9 @@ void CScriptSpindleCamera::Think(float dt, CStateManager& mgr) { } } else { const float hintCamCross = hintToCamDir.toVec2f().cross(hintDir.toVec2f()); - if ((hintBallAngle < x310_recoverClampedAzimuthFromHintDir. - GetValue(GetInVar(x310_recoverClampedAzimuthFromHintDir)) && hintBallCross * hintCamCross < 0.f) || + if ((hintBallAngle < + x310_recoverClampedAzimuthFromHintDir.GetValue(GetInVar(x310_recoverClampedAzimuthFromHintDir)) && + hintBallCross * hintCamCross < 0.f) || hintBallAngle <= x2b0_clampedAzimuthFromHintDir.GetValue(GetInVar(x2b0_clampedAzimuthFromHintDir))) { x32c_outsideClampedAzimuth = false; } else { @@ -224,7 +217,8 @@ void CScriptSpindleCamera::Think(float dt, CStateManager& mgr) { hintBallToCamTargetAzimuthQuat.rotateZ(hintBallToCamTargetAzimuth); const zeus::CVector3f targetHintToCam = hintBallToCamTargetAzimuthQuat.transform(hintToBallDir); zeus::CVector3f newHintToCamDir = hintToCamDir; - const float hintToCamDeltaAngleRange = std::fabs(std::acos(zeus::clamp(-1.f, hintToCamDir.dot(targetHintToCam), 1.f))); + const float hintToCamDeltaAngleRange = + std::fabs(std::acos(zeus::clamp(-1.f, hintToCamDir.dot(targetHintToCam), 1.f))); const float hintToCamDeltaAngleSpeedFactor = zeus::clamp( -1.f, hintToCamDeltaAngleRange / x2c8_dampingAzimuthSpeed.GetValue(GetInVar(x2c8_dampingAzimuthSpeed)), 1.f); float targetHintToCamDeltaAngleVel = @@ -251,8 +245,8 @@ void CScriptSpindleCamera::Think(float dt, CStateManager& mgr) { camToBallDist = camToBall.magnitude(); } targetHintToCamDeltaAngle *= (1.f - zeus::clamp(0.f, (camToBallDist - 2.f) * 0.5f, 1.f)) * 10.f + 1.f; - targetHintToCamDeltaAngle = zeus::clamp(-hintToCamDeltaAngleRange, - targetHintToCamDeltaAngle, hintToCamDeltaAngleRange); + targetHintToCamDeltaAngle = + zeus::clamp(-hintToCamDeltaAngleRange, targetHintToCamDeltaAngle, hintToCamDeltaAngleRange); if (std::fabs(zeus::clamp(-1.f, hintToCamDir.dot(targetHintToCam), 1.f)) < 0.99999f) { newHintToCamDir = zeus::CQuaternion::lookAt(hintToCamDir, targetHintToCam, targetHintToCamDeltaAngle).transform(hintToCamDir); @@ -350,7 +344,7 @@ void CScriptSpindleCamera::Think(float dt, CStateManager& mgr) { zeus::CQuaternion azimuthQuat; azimuthQuat.rotateZ(camLookRelAzimuth); lookAheadPos = azimuthQuat.transform(newLookDirFlat).toVec2f() * std::cos(camLookRelAzimuth) * newLookDistFlat + - newCamPos.toVec2f(); + newCamPos.toVec2f(); } newLookDelta = zeus::CVector3f(lookAheadPos, lookPosZ) - newCamPos; if ((x188_flags & 0x1) != 0) { diff --git a/Runtime/World/CScriptSpindleCamera.hpp b/Runtime/World/CScriptSpindleCamera.hpp index cae6fc45a..86a718a7c 100644 --- a/Runtime/World/CScriptSpindleCamera.hpp +++ b/Runtime/World/CScriptSpindleCamera.hpp @@ -84,20 +84,14 @@ class CScriptSpindleCamera : public CGameCamera { public: DEFINE_ENTITY - CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info, - const zeus::CTransform& xf, bool active, u32 flags, float hintToCamDistMin, - float hintToCamDistMax, float hintToCamVOffMin, float hintToCamVOffMax, - const SSpindleProperty& targetHintToCamDeltaAngleVel, - const SSpindleProperty& deltaAngleScaleWithCamDist, - const SSpindleProperty& hintToCamDist, - const SSpindleProperty& distOffsetFromBallDist, - const SSpindleProperty& hintBallToCamAzimuth, - const SSpindleProperty& unused, - const SSpindleProperty& maxHintBallToCamAzimuth, - const SSpindleProperty& camLookRelAzimuth, - const SSpindleProperty& lookPosZOffset, - const SSpindleProperty& camPosZOffset, - const SSpindleProperty& clampedAzimuthFromHintDir, + CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, + bool active, u32 flags, float hintToCamDistMin, float hintToCamDistMax, float hintToCamVOffMin, + float hintToCamVOffMax, const SSpindleProperty& targetHintToCamDeltaAngleVel, + const SSpindleProperty& deltaAngleScaleWithCamDist, const SSpindleProperty& hintToCamDist, + const SSpindleProperty& distOffsetFromBallDist, const SSpindleProperty& hintBallToCamAzimuth, + const SSpindleProperty& unused, const SSpindleProperty& maxHintBallToCamAzimuth, + const SSpindleProperty& camLookRelAzimuth, const SSpindleProperty& lookPosZOffset, + const SSpindleProperty& camPosZOffset, const SSpindleProperty& clampedAzimuthFromHintDir, const SSpindleProperty& dampingAzimuthSpeed, const SSpindleProperty& targetHintToCamDeltaAngleVelRange, const SSpindleProperty& deleteHintBallDist, diff --git a/Runtime/World/CScriptTrigger.hpp b/Runtime/World/CScriptTrigger.hpp index 0b3f14bd7..24f451280 100644 --- a/Runtime/World/CScriptTrigger.hpp +++ b/Runtime/World/CScriptTrigger.hpp @@ -62,6 +62,7 @@ protected: bool x148_29_didPhazonDamage : 1 = false; CAABoxShader m_debugBox; + public: DEFINE_ENTITY CScriptTrigger(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos, diff --git a/Runtime/World/CScriptWater.cpp b/Runtime/World/CScriptWater.cpp index d001fbf78..7cfabff5b 100644 --- a/Runtime/World/CScriptWater.cpp +++ b/Runtime/World/CScriptWater.cpp @@ -19,14 +19,14 @@ constexpr std::array kSplashScales{ CScriptWater::CScriptWater( CStateManager& mgr, TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos, - const zeus::CAABox& box, const metaforce::CDamageInfo& dInfo, zeus::CVector3f& orientedForce, ETriggerFlags triggerFlags, - bool thermalCold, bool allowRender, CAssetId patternMap1, CAssetId patternMap2, CAssetId colorMap, CAssetId bumpMap, - CAssetId envMap, CAssetId envBumpMap, CAssetId unusedMap, const zeus::CVector3f& bumpLightDir, float bumpScale, - float morphInTime, float morphOutTime, bool active, EFluidType fluidType, bool b4, float alpha, - const CFluidUVMotion& uvMot, float turbSpeed, float turbDistance, float turbFreqMax, float turbFreqMin, - float turbPhaseMax, float turbPhaseMin, float turbAmplitudeMax, float turbAmplitudeMin, - const zeus::CColor& splashColor, const zeus::CColor& insideFogColor, CAssetId splashParticle1, - CAssetId splashParticle2, CAssetId splashParticle3, CAssetId visorRunoffParticle, + const zeus::CAABox& box, const metaforce::CDamageInfo& dInfo, zeus::CVector3f& orientedForce, + ETriggerFlags triggerFlags, bool thermalCold, bool allowRender, CAssetId patternMap1, CAssetId patternMap2, + CAssetId colorMap, CAssetId bumpMap, CAssetId envMap, CAssetId envBumpMap, CAssetId unusedMap, + const zeus::CVector3f& bumpLightDir, float bumpScale, float morphInTime, float morphOutTime, bool active, + EFluidType fluidType, bool b4, float alpha, const CFluidUVMotion& uvMot, float turbSpeed, float turbDistance, + float turbFreqMax, float turbFreqMin, float turbPhaseMax, float turbPhaseMin, float turbAmplitudeMax, + float turbAmplitudeMin, const zeus::CColor& splashColor, const zeus::CColor& insideFogColor, + CAssetId splashParticle1, CAssetId splashParticle2, CAssetId splashParticle3, CAssetId visorRunoffParticle, CAssetId unmorphVisorRunoffparticle, s32 visorRunoffSfx, s32 unmorphVisorRunoffSfx, s32 splashSfx1, s32 splashSfx2, s32 splashSfx3, float tileSize, u32 tileSubdivisions, float specularMin, float specularMax, float reflectionSize, float rippleIntensity, float reflectionBlend, float fogBias, float fogMagnitude, float fogSpeed, diff --git a/Runtime/World/CScriptWater.hpp b/Runtime/World/CScriptWater.hpp index be8ffe3e7..dddfe8d73 100644 --- a/Runtime/World/CScriptWater.hpp +++ b/Runtime/World/CScriptWater.hpp @@ -123,9 +123,7 @@ public: void SetFrustumPlanes(const zeus::CFrustum& frustum) { x150_frustum = frustum; } const zeus::CFrustum& GetFrustumPlanes() const { return x150_frustum; } CFluidPlaneCPU& GetFluidPlane() const { return *x1b4_fluidPlane; } - const std::optional>& GetVisorRunoffEffect() const { - return x23c_visorRunoffEffect; - } + const std::optional>& GetVisorRunoffEffect() const { return x23c_visorRunoffEffect; } u16 GetVisorRunoffSfx() const { return x260_visorRunoffSfx; } const std::optional>& GetUnmorphVisorRunoffEffect() const { return x250_unmorphVisorRunoffEffect; diff --git a/Runtime/World/CScriptWaypoint.cpp b/Runtime/World/CScriptWaypoint.cpp index 16696bb4d..ed2486eeb 100644 --- a/Runtime/World/CScriptWaypoint.cpp +++ b/Runtime/World/CScriptWaypoint.cpp @@ -30,7 +30,7 @@ void CScriptWaypoint::Accept(IVisitor& visitor) { visitor.Visit(this); } void CScriptWaypoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) { CActor::AcceptScriptMsg(msg, sender, mgr); if (GetActive() && msg == EScriptObjectMessage::Arrived) - SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None); + SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None); } void CScriptWaypoint::AddToRenderer(const zeus::CFrustum&, CStateManager&) { diff --git a/Runtime/World/CScriptWorldTeleporter.cpp b/Runtime/World/CScriptWorldTeleporter.cpp index c27fda842..c559cdf8c 100644 --- a/Runtime/World/CScriptWorldTeleporter.cpp +++ b/Runtime/World/CScriptWorldTeleporter.cpp @@ -11,9 +11,7 @@ namespace metaforce { CScriptWorldTeleporter::CScriptWorldTeleporter(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active, CAssetId worldId, CAssetId areaId) -: CEntity(uid, info, active, name) -, x34_worldId(worldId) -, x38_areaId(areaId) {} +: CEntity(uid, info, active, name), x34_worldId(worldId), x38_areaId(areaId) {} CScriptWorldTeleporter::CScriptWorldTeleporter(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active, CAssetId worldId, CAssetId areaId, CAssetId playerAncs, diff --git a/Runtime/World/CSnakeWeedSwarm.hpp b/Runtime/World/CSnakeWeedSwarm.hpp index fc86fcb0f..acefd4956 100644 --- a/Runtime/World/CSnakeWeedSwarm.hpp +++ b/Runtime/World/CSnakeWeedSwarm.hpp @@ -96,8 +96,8 @@ public: const CActorParameters& actParms, float spacing, float height, float f3, float weaponDamageRadius, float maxPlayerDistance, float loweredTime, float loweredTimeVariation, float maxZOffset, float speed, float speedVariation, float f11, float scaleMin, float scaleMax, float distanceBelowGround, - const CDamageInfo& dInfo, float /*f15*/, u32 sfxId1, u32 sfxId2, u32 sfxId3, CAssetId particleGenDesc1, u32 w5, - CAssetId particleGenDesc2, float f16); + const CDamageInfo& dInfo, float /*f15*/, u32 sfxId1, u32 sfxId2, u32 sfxId3, + CAssetId particleGenDesc1, u32 w5, CAssetId particleGenDesc2, float f16); void Accept(IVisitor&) override; void ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info, CStateManager& stateMgr); diff --git a/Runtime/World/CTeamAiMgr.cpp b/Runtime/World/CTeamAiMgr.cpp index 3983e2a2c..d3dad318c 100644 --- a/Runtime/World/CTeamAiMgr.cpp +++ b/Runtime/World/CTeamAiMgr.cpp @@ -275,8 +275,7 @@ bool CTeamAiMgr::AddRangedAttacker(TUniqueId aiId) { x78_rangedAttackers.size() < x34_data.x14_maxRangedAttackerCount && HasTeamAiRole(aiId)) { auto search = rstl::binary_find(x78_rangedAttackers.begin(), x78_rangedAttackers.end(), aiId); if (search == x78_rangedAttackers.end()) { - x78_rangedAttackers.insert( - std::lower_bound(x78_rangedAttackers.begin(), x78_rangedAttackers.end(), aiId), aiId); + x78_rangedAttackers.insert(std::lower_bound(x78_rangedAttackers.begin(), x78_rangedAttackers.end(), aiId), aiId); x94_timeSinceRanged = 0.f; } return true; diff --git a/Runtime/World/CVisorFlare.cpp b/Runtime/World/CVisorFlare.cpp index eeb49ff72..0e49a8630 100644 --- a/Runtime/World/CVisorFlare.cpp +++ b/Runtime/World/CVisorFlare.cpp @@ -63,15 +63,16 @@ void CVisorFlare::Update(float dt, const zeus::CVector3f& pos, const CActor* act x24_ = 1.f - (x28_ / x18_f1); const CGameCamera* curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr); - x24_ *= std::max(0.f, 1.f - (4.f * x1c_f2 * (1.f - (pos - curCam->GetTranslation()).dot(curCam->GetTransform().basis[1])))); + x24_ *= std::max( + 0.f, 1.f - (4.f * x1c_f2 * (1.f - (pos - curCam->GetTranslation()).dot(curCam->GetTransform().basis[1])))); if (x2c_w1 == 2) { mgr.SetThermalColdScale2(mgr.GetThermalColdScale2() + x24_); } -//#ifndef NDEBUG -// printf("%08X %f %f\n", act->GetEditorId().id, x24_, x28_); -//#endif + //#ifndef NDEBUG + // printf("%08X %f %f\n", act->GetEditorId().id, x24_, x28_); + //#endif } } @@ -91,8 +92,8 @@ void CVisorFlare::Render(const zeus::CVector3f& pos, const CStateManager& mgr) c return; CGraphics::DisableAllLights(); // g_Renderer->SetDepthReadWrite(false, false); - //const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); - //zeus::CVector3f camPos = cam->GetTranslation(); + // const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); + // zeus::CVector3f camPos = cam->GetTranslation(); } } diff --git a/Runtime/World/CVisorFlare.hpp b/Runtime/World/CVisorFlare.hpp index 821b9f1c9..db0370629 100644 --- a/Runtime/World/CVisorFlare.hpp +++ b/Runtime/World/CVisorFlare.hpp @@ -25,8 +25,8 @@ public: zeus::CColor x10_color; public: - CFlareDef()=default; - CFlareDef(const CFlareDef&)=default; + CFlareDef() = default; + CFlareDef(const CFlareDef&) = default; CFlareDef(const TToken& tex, float f1, float f2, const zeus::CColor& color) : x0_tex(tex), x8_f1(f1), xc_f2(f2), x10_color(color) { x0_tex.Lock(); diff --git a/Runtime/World/CWallCrawlerSwarm.cpp b/Runtime/World/CWallCrawlerSwarm.cpp index 0296e660e..e27c03f2f 100644 --- a/Runtime/World/CWallCrawlerSwarm.cpp +++ b/Runtime/World/CWallCrawlerSwarm.cpp @@ -30,20 +30,16 @@ static CMaterialList MakeMaterialList() { EMaterialTypes::RadarObject); } -CWallCrawlerSwarm::CWallCrawlerSwarm(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, - const zeus::CVector3f& boundingBoxExtent, const zeus::CTransform& xf, - EFlavor flavor, const CAnimRes& animRes, s32 launchAnim, s32 attractAnim, - CAssetId part1, CAssetId part2, CAssetId part3, CAssetId part4, - const CDamageInfo& crabDamage, const CDamageInfo& scarabExplodeDamage, - float crabDamageCooldown, float boidRadius, float touchRadius, - float playerTouchRadius, u32 numBoids, u32 maxCreatedBoids, - float animPlaybackSpeed, float separationRadius, float cohesionMagnitude, - float alignmentWeight, float separationMagnitude, float moveToWaypointWeight, - float attractionMagnitude, float attractionRadius, float boidGenRate, - u32 maxLaunches, float scarabBoxMargin, float scarabScatterXYVelocity, - float scarabTimeToExplode, const CHealthInfo& hInfo, - const CDamageVulnerability& dVuln, s32 launchSfx, - s32 scatterSfx, const CActorParameters& aParams) +CWallCrawlerSwarm::CWallCrawlerSwarm( + TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, + const zeus::CVector3f& boundingBoxExtent, const zeus::CTransform& xf, EFlavor flavor, const CAnimRes& animRes, + s32 launchAnim, s32 attractAnim, CAssetId part1, CAssetId part2, CAssetId part3, CAssetId part4, + const CDamageInfo& crabDamage, const CDamageInfo& scarabExplodeDamage, float crabDamageCooldown, float boidRadius, + float touchRadius, float playerTouchRadius, u32 numBoids, u32 maxCreatedBoids, float animPlaybackSpeed, + float separationRadius, float cohesionMagnitude, float alignmentWeight, float separationMagnitude, + float moveToWaypointWeight, float attractionMagnitude, float attractionRadius, float boidGenRate, u32 maxLaunches, + float scarabBoxMargin, float scarabScatterXYVelocity, float scarabTimeToExplode, const CHealthInfo& hInfo, + const CDamageVulnerability& dVuln, s32 launchSfx, s32 scatterSfx, const CActorParameters& aParams) : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), MakeMaterialList(), aParams, kInvalidUniqueId) , x118_boundingBoxExtent(boundingBoxExtent) , x13c_separationRadius(separationRadius) @@ -122,15 +118,15 @@ CWallCrawlerSwarm::CWallCrawlerSwarm(TUniqueId uid, bool active, std::string_vie void CWallCrawlerSwarm::Accept(IVisitor& visitor) { visitor.Visit(this); } void CWallCrawlerSwarm::AllocateSkinnedModels(CStateManager& mgr, CModelData::EWhichModel which) { - //x430_.clear(); + // x430_.clear(); for (size_t i = 0; i < 9; ++i) { - //x430_.push_back(x4b0_[i]->PickAnimatedModel(which).Clone()); + // x430_.push_back(x4b0_[i]->PickAnimatedModel(which).Clone()); x4b0_modelDatas[i]->EnableLooping(true); x4b0_modelDatas[i]->AdvanceAnimation(x4b0_modelDatas[i]->GetAnimationData()->GetAnimTimeRemaining("Whole Body"sv) * (float(i) * 0.0625f), mgr, x4_areaId, true); } - //x430_.push_back(x4b0_.back()->PickAnimatedModel(which).Clone()); + // x430_.push_back(x4b0_.back()->PickAnimatedModel(which).Clone()); x4dc_whichModel = which; } @@ -306,7 +302,7 @@ static zeus::CTransform LookAt(const zeus::CUnitVector3f& a, const zeus::CUnitVe } void CWallCrawlerSwarm::CreateBoid(CStateManager& mgr, int idx) { - //zeus::CAABox aabb = GetBoundingBox(); + // zeus::CAABox aabb = GetBoundingBox(); const TUniqueId wpId = GetWaypointForState(EScriptObjectState::Patrol, mgr); if (TCastToConstPtr wp = mgr.GetObjectById(wpId)) { const CCollisionSurface surf = FindBestCollisionInBox(mgr, wp->GetTranslation()); @@ -592,8 +588,8 @@ void CWallCrawlerSwarm::UpdateBoid(const CAreaCollisionCache& ccache, CStateMana ApplyAlignment(boid, nearList, aheadVec); break; case 3: - ApplyAttraction(boid, mgr.GetPlayer().GetTranslation(), x154_attractionRadius, - x150_attractionMagnitude, aheadVec); + ApplyAttraction(boid, mgr.GetPlayer().GetTranslation(), x154_attractionRadius, x150_attractionMagnitude, + aheadVec); break; default: break; @@ -775,8 +771,7 @@ void CWallCrawlerSwarm::Think(float dt, CStateManager& mgr) { x36c_crabDamageCooldownTimer -= dt; ++x100_thinkCounter; const CGameArea* area = mgr.GetWorld()->GetAreaAlways(x4_areaId); - const auto occState = - area->IsPostConstructed() ? area->GetOcclusionState() : CGameArea::EOcclusionState::Occluded; + const auto occState = area->IsPostConstructed() ? area->GetOcclusionState() : CGameArea::EOcclusionState::Occluded; if (occState != CGameArea::EOcclusionState::Visible) { if (x104_occludedTimer > 0.f) { x104_occludedTimer -= dt; @@ -801,8 +796,7 @@ void CWallCrawlerSwarm::Think(float dt, CStateManager& mgr) { AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); } - while ((x54c_maxCreatedBoids == 0 || x550_createdBoids < x54c_maxCreatedBoids) && - x368_boidGenCooldownTimer <= 0.f) { + while ((x54c_maxCreatedBoids == 0 || x550_createdBoids < x54c_maxCreatedBoids) && x368_boidGenCooldownTimer <= 0.f) { int idx = 0; bool madeBoid = false; for (const auto& b : x108_boids) { @@ -1080,8 +1074,9 @@ void CWallCrawlerSwarm::RenderBoid(const CBoid* boid, u32& drawMask, bool therma } void CWallCrawlerSwarm::Render(CStateManager& mgr) { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CWallCrawlerSwarm::Render {} {} {}"), - x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); + SCOPED_GRAPHICS_DEBUG_GROUP( + fmt::format(FMT_STRING("CWallCrawlerSwarm::Render {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), + zeus::skOrange); u32 drawMask = 0xffffffff; const bool r24 = x560_24_enableLighting; const bool r23 = x560_25_useSoftwareLight; @@ -1147,17 +1142,11 @@ void CWallCrawlerSwarm::Render(CStateManager& mgr) { DrawTouchBounds(); } -bool CWallCrawlerSwarm::CanRenderUnsorted(const CStateManager&) const { - return true; -} +bool CWallCrawlerSwarm::CanRenderUnsorted(const CStateManager&) const { return true; } -void CWallCrawlerSwarm::CalculateRenderBounds() { - x9c_renderBounds = GetBoundingBox(); -} +void CWallCrawlerSwarm::CalculateRenderBounds() { x9c_renderBounds = GetBoundingBox(); } -std::optional CWallCrawlerSwarm::GetTouchBounds() const { - return {xe8_aabox}; -} +std::optional CWallCrawlerSwarm::GetTouchBounds() const { return {xe8_aabox}; } void CWallCrawlerSwarm::Touch(CActor& other, CStateManager& mgr) { CActor::Touch(other, mgr); @@ -1199,13 +1188,13 @@ void CWallCrawlerSwarm::Touch(CActor& other, CStateManager& mgr) { if (b.GetActive() && x558_flavor == EFlavor::Parasite) { constexpr CDamageInfo dInfo(CWeaponMode(EWeaponType::AI), 2.0e-05f, 0.f, 0.f); mgr.ApplyDamage(GetUniqueId(), player->GetUniqueId(), GetUniqueId(), dInfo, - CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); + CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); KillBoid(b, mgr, 0.f, 1.f); } else if (x558_flavor == EFlavor::Scarab) { ExplodeBoid(b, mgr); } else if (x36c_crabDamageCooldownTimer <= 0.f) { mgr.ApplyDamage(GetUniqueId(), player->GetUniqueId(), GetUniqueId(), x384_crabDamage, - CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); + CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); x36c_crabDamageCooldownTimer = x370_crabDamageCooldown; break; } @@ -1232,7 +1221,8 @@ zeus::CVector3f CWallCrawlerSwarm::GetAimPosition(const CStateManager&, float dt return x108_boids[x42c_lockOnIdx].x30_velocity * dt + x124_lastOrbitPosition; } -void CWallCrawlerSwarm::ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info, CStateManager& stateMgr) { +void CWallCrawlerSwarm::ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info, + CStateManager& stateMgr) { for (CBoid& boid : x108_boids) { if (boid.GetActive() && (boid.GetTranslation() - pos).magSquared() < info.GetRadius() * info.GetRadius()) { boid.x78_health -= info.GetRadiusDamage(); diff --git a/Runtime/World/CWallCrawlerSwarm.hpp b/Runtime/World/CWallCrawlerSwarm.hpp index 69636fd11..fd1f08fcc 100644 --- a/Runtime/World/CWallCrawlerSwarm.hpp +++ b/Runtime/World/CWallCrawlerSwarm.hpp @@ -21,11 +21,7 @@ namespace metaforce { class CAreaCollisionCache; class CWallCrawlerSwarm : public CActor { public: - enum class EFlavor { - Parasite, - Scarab, - Crab - }; + enum class EFlavor { Parasite, Scarab, Crab }; class CBoid { friend class CWallCrawlerSwarm; zeus::CTransform x0_xf; @@ -35,9 +31,8 @@ public: CBoid* x44_next = nullptr; float x48_timeToDie = 0.f; float x4c_timeToExplode = 0.f; - CCollisionSurface x50_surface = - CCollisionSurface(zeus::CVector3f(0.f, 0.f, 1.f), zeus::CVector3f(0.f, 1.f, 0.f), - zeus::CVector3f(1.f, 0.f, 0.f), 0xffffffff); + CCollisionSurface x50_surface = CCollisionSurface(zeus::CVector3f(0.f, 0.f, 1.f), zeus::CVector3f(0.f, 1.f, 0.f), + zeus::CVector3f(1.f, 0.f, 0.f), 0xffffffff); float x78_health = 0.f; int x7c_framesNotOnSurface : 8 = 0; int x7c_idx : 10; @@ -61,6 +56,7 @@ public: friend class CWallCrawlerSwarm; zeus::CVector3f x0_center; float xc_mag; + public: CRepulsor(const zeus::CVector3f& center, float mag) : x0_center(center), xc_mag(mag) {} }; @@ -100,8 +96,8 @@ private: CDamageVulnerability x3c4_dVuln; s32 x42c_lockOnIdx = -1; /* Used to be position and normal array pointers */ - //rstl::reserved_vector, 10> x430_; - //rstl::reserved_vector, 10> x484_; + // rstl::reserved_vector, 10> x430_; + // rstl::reserved_vector, 10> x484_; rstl::reserved_vector, 10> x4b0_modelDatas; CModelData::EWhichModel x4dc_whichModel = CModelData::EWhichModel::Normal; std::vector x4e0_doorRepulsors; @@ -142,18 +138,18 @@ private: void BuildBoidNearList(const CBoid& boid, float radius, rstl::reserved_vector& nearList); void ApplySeparation(const CBoid& boid, const rstl::reserved_vector& nearList, zeus::CVector3f& aheadVec) const; - void ApplySeparation(const CBoid& boid, const zeus::CVector3f& separateFrom, float separationRadius, float separationMagnitude, - zeus::CVector3f& aheadVec) const; + void ApplySeparation(const CBoid& boid, const zeus::CVector3f& separateFrom, float separationRadius, + float separationMagnitude, zeus::CVector3f& aheadVec) const; void ScatterScarabBoid(CBoid& boid, CStateManager& mgr) const; void MoveToWayPoint(CBoid& boid, CStateManager& mgr, zeus::CVector3f& aheadVec) const; void ApplyCohesion(const CBoid& boid, const rstl::reserved_vector& nearList, zeus::CVector3f& aheadVec) const; - void ApplyCohesion(const CBoid& boid, const zeus::CVector3f& cohesionFrom, float cohesionRadius, float cohesionMagnitude, - zeus::CVector3f& aheadVec) const; + void ApplyCohesion(const CBoid& boid, const zeus::CVector3f& cohesionFrom, float cohesionRadius, + float cohesionMagnitude, zeus::CVector3f& aheadVec) const; void ApplyAlignment(const CBoid& boid, const rstl::reserved_vector& nearList, zeus::CVector3f& aheadVec) const; - void ApplyAttraction(const CBoid& boid, const zeus::CVector3f& attractTo, float attractionRadius, float attractionMagnitude, - zeus::CVector3f& aheadVec) const; + void ApplyAttraction(const CBoid& boid, const zeus::CVector3f& attractTo, float attractionRadius, + float attractionMagnitude, zeus::CVector3f& aheadVec) const; void UpdateBoid(const CAreaCollisionCache& ccache, CStateManager& mgr, float dt, CBoid& boid); void LaunchBoid(CBoid& boid, const zeus::CVector3f& dir); void AddParticle(const zeus::CTransform& xf); @@ -170,19 +166,16 @@ private: public: DEFINE_ENTITY CWallCrawlerSwarm(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, - const zeus::CVector3f& boundingBoxExtent, const zeus::CTransform& xf, - EFlavor flavor, const CAnimRes& animRes, s32 launchAnim, s32 attractAnim, - CAssetId part1, CAssetId part2, CAssetId part3, CAssetId part4, - const CDamageInfo& crabDamage, const CDamageInfo& scarabExplodeDamage, - float crabDamageCooldown, float boidRadius, float touchRadius, - float playerTouchRadius, u32 numBoids, u32 maxCreatedBoids, - float animPlaybackSpeed, float separationRadius, float cohesionMagnitude, - float alignmentWeight, float separationMagnitude, float moveToWaypointWeight, - float attractionMagnitude, float attractionRadius, float boidGenRate, - u32 maxLaunches, float scarabBoxMargin, float scarabScatterXYVelocity, - float scarabTimeToExplode, const CHealthInfo& hInfo, - const CDamageVulnerability& dVuln, s32 launchSfx, - s32 scatterSfx, const CActorParameters& aParams); + const zeus::CVector3f& boundingBoxExtent, const zeus::CTransform& xf, EFlavor flavor, + const CAnimRes& animRes, s32 launchAnim, s32 attractAnim, CAssetId part1, CAssetId part2, + CAssetId part3, CAssetId part4, const CDamageInfo& crabDamage, + const CDamageInfo& scarabExplodeDamage, float crabDamageCooldown, float boidRadius, + float touchRadius, float playerTouchRadius, u32 numBoids, u32 maxCreatedBoids, + float animPlaybackSpeed, float separationRadius, float cohesionMagnitude, float alignmentWeight, + float separationMagnitude, float moveToWaypointWeight, float attractionMagnitude, + float attractionRadius, float boidGenRate, u32 maxLaunches, float scarabBoxMargin, + float scarabScatterXYVelocity, float scarabTimeToExplode, const CHealthInfo& hInfo, + const CDamageVulnerability& dVuln, s32 launchSfx, s32 scatterSfx, const CActorParameters& aParams); void Accept(IVisitor& visitor) override; void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index f22b98010..b26688dbf 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -94,7 +94,8 @@ std::optional CWorldLayers::ReadWorldLayers(athena::io::MemoryRead const u32 nameCount = r.readUint32Big(); ret.m_names.reserve(nameCount); for (u32 i = 0; i < nameCount; ++i) { - ret.m_names.push_back(r.readString()); + auto name = r.readString(); + ret.m_names.emplace_back(name); } areaCount = r.readUint32Big(); diff --git a/Runtime/World/CWorldTransManager.cpp b/Runtime/World/CWorldTransManager.cpp index 25ed17053..0fc402dfe 100644 --- a/Runtime/World/CWorldTransManager.cpp +++ b/Runtime/World/CWorldTransManager.cpp @@ -189,8 +189,7 @@ void CWorldTransManager::DrawPlatformModels(CActorLights* lights) { } if (!x4_modelData->xb4_platformModelData.IsNull()) { - x4_modelData->xb4_platformModelData.Render(CModelData::EWhichModel::Normal, zeus::CTransform(), lights, - flags); + x4_modelData->xb4_platformModelData.Render(CModelData::EWhichModel::Normal, zeus::CTransform(), lights, flags); } } @@ -202,8 +201,7 @@ void CWorldTransManager::DrawAllModels(CActorLights* lights) { flags.m_extendedShader = EExtendedShader::LightingCubeReflection; x4_modelData->x1c_samusModelData.GetAnimationData()->PreRender(); - x4_modelData->x1c_samusModelData.Render(CModelData::EWhichModel::Normal, zeus::CTransform(), lights, - flags); + x4_modelData->x1c_samusModelData.Render(CModelData::EWhichModel::Normal, zeus::CTransform(), lights, flags); if (!x4_modelData->x68_beamModelData.IsNull()) { x4_modelData->x68_beamModelData.Render(CModelData::EWhichModel::Normal, x4_modelData->x170_gunXf, lights, flags); @@ -248,23 +246,26 @@ void CWorldTransManager::DrawEnabled() { if (x0_curTime < x4_modelData->x1d4_dissolveEndTime) { zeus::CTransform mainCamXf = - zeus::CTransform::RotateZ(zeus::degToRad(zeus::clamp(0.f, x0_curTime / 25.f, 100.f) * 360.f + 180.f - 90.f)); + zeus::CTransform::RotateZ(zeus::degToRad(zeus::clamp(0.f, x0_curTime / 25.f, 100.f) * 360.f + 180.f - 90.f)); for (int face = 0; face < 6; ++face) { CGraphics::g_BooMainCommandQueue->setRenderTarget(m_reflectionCube[0], face); CGraphics::g_BooMainCommandQueue->clearTarget(); - zeus::CTransform camXf = zeus::CTransform(mainCamXf.basis * CGraphics::skCubeBasisMats[face], zeus::CVector3f(0.f, 0.f, 1.5f)); + zeus::CTransform camXf = + zeus::CTransform(mainCamXf.basis * CGraphics::skCubeBasisMats[face], zeus::CVector3f(0.f, 0.f, 1.5f)); g_Renderer->SetWorldViewpoint(camXf); DrawPlatformModels(&lights); } CGraphics::g_BooMainCommandQueue->generateMipmaps(m_reflectionCube[0]); } if (x0_curTime > x4_modelData->x1d0_dissolveStartTime) { - zeus::CTransform mainCamXf = zeus::CTransform::RotateZ(zeus::degToRad( - 48.f * zeus::clamp(0.f, (x0_curTime - x4_modelData->x1d0_dissolveStartTime + 2.f) / 5.f, 1.f) + 180.f - 24.f)); + zeus::CTransform mainCamXf = zeus::CTransform::RotateZ( + zeus::degToRad(48.f * zeus::clamp(0.f, (x0_curTime - x4_modelData->x1d0_dissolveStartTime + 2.f) / 5.f, 1.f) + + 180.f - 24.f)); for (int face = 0; face < 6; ++face) { CGraphics::g_BooMainCommandQueue->setRenderTarget(m_reflectionCube[1], face); CGraphics::g_BooMainCommandQueue->clearTarget(); - zeus::CTransform camXf = zeus::CTransform(mainCamXf.basis * CGraphics::skCubeBasisMats[face], zeus::CVector3f(0.f, 0.f, 1.5f)); + zeus::CTransform camXf = + zeus::CTransform(mainCamXf.basis * CGraphics::skCubeBasisMats[face], zeus::CVector3f(0.f, 0.f, 1.5f)); g_Renderer->SetWorldViewpoint(camXf); DrawPlatformModels(&lights); } diff --git a/Runtime/platforms/freedesktop/CMakeLists.txt b/Runtime/platforms/freedesktop/CMakeLists.txt index 855056423..6e21e9066 100644 --- a/Runtime/platforms/freedesktop/CMakeLists.txt +++ b/Runtime/platforms/freedesktop/CMakeLists.txt @@ -3,16 +3,16 @@ target_link_libraries(mkwmicon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) target_include_directories(mkwmicon PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) macro(declare_wmicon_target) -add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Runtime/platforms/freedesktop/mainicon_netwm.bin - COMMAND $ - ARGS ${CMAKE_BINARY_DIR}/Runtime/platforms/freedesktop/mainicon_netwm.bin - DEPENDS - ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/128x128/apps/metaforce.png - ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/64x64/apps/metaforce.png - ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/48x48/apps/metaforce.png - ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/32x32/apps/metaforce.png - ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/16x16/apps/metaforce.png - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop - COMMENT "Generating mainicon_netwm.bin") -bintoc(mainicon_netwm.cpp ${CMAKE_BINARY_DIR}/Runtime/platforms/freedesktop/mainicon_netwm.bin MAINICON_NETWM) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Runtime/platforms/freedesktop/mainicon_netwm.bin + COMMAND $ + ARGS ${CMAKE_BINARY_DIR}/Runtime/platforms/freedesktop/mainicon_netwm.bin + DEPENDS + ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/128x128/apps/metaforce.png + ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/64x64/apps/metaforce.png + ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/48x48/apps/metaforce.png + ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/32x32/apps/metaforce.png + ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop/16x16/apps/metaforce.png + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Runtime/platforms/freedesktop + COMMENT "Generating mainicon_netwm.bin") + bintoc(mainicon_netwm.cpp ${CMAKE_BINARY_DIR}/Runtime/platforms/freedesktop/mainicon_netwm.bin MAINICON_NETWM) endmacro() diff --git a/Runtime/platforms/freedesktop/mkwmicon.c b/Runtime/platforms/freedesktop/mkwmicon.c index d3e0dd55c..261901952 100644 --- a/Runtime/platforms/freedesktop/mkwmicon.c +++ b/Runtime/platforms/freedesktop/mkwmicon.c @@ -6,150 +6,127 @@ #include #include -static int CountBits(uint32_t n) -{ - int ret = 0; - for (int i=0 ; i<32 ; ++i) - if (((n >> i) & 1) != 0) - ++ret; - return ret; +static int CountBits(uint32_t n) { + int ret = 0; + for (int i = 0; i < 32; ++i) + if (((n >> i) & 1) != 0) + ++ret; + return ret; } -static const int DIMS[] = -{ - 16, - 32, - 48, - 64, - 128, - 0 -}; +static const int DIMS[] = {16, 32, 48, 64, 128, 0}; -int main(int argc, char* argv[]) -{ - if (argc < 2) - { - fprintf(stderr, "Usage: makewmicon \n"); - return 1; +int main(int argc, char* argv[]) { + if (argc < 2) { + fprintf(stderr, "Usage: makewmicon \n"); + return 1; + } + + FILE* ofp = fopen(argv[1], "wb"); + if (!ofp) { + fprintf(stderr, "'%s' is not able to be opened for writing as a regular file\n", argv[1]); + return 1; + } + + png_bytep row = malloc(4 * 128); + + char command[2048]; + + for (const int* d = DIMS; *d != 0; ++d) { + printf("Rendering main icon @%dx%d\n", *d, *d); + fflush(stdout); + + snprintf(command, 2048, "%dx%d/apps/metaforce.png", *d, *d); + FILE* fp = fopen(command, "rb"); + if (!fp) { + fprintf(stderr, "unable to open '%s' for reading\n", command); + fclose(ofp); + return 1; } - FILE* ofp = fopen(argv[1], "wb"); - if (!ofp) - { - fprintf(stderr, "'%s' is not able to be opened for writing as a regular file\n", argv[1]); - return 1; + char header[8]; + fread(header, 1, 8, fp); + if (png_sig_cmp((png_const_bytep)header, 0, 8)) { + fprintf(stderr, "invalid PNG signature in '%s'\n", command); + fclose(fp); + fclose(ofp); + return 1; } - png_bytep row = malloc(4 * 128); - - char command[2048]; - - for (const int* d = DIMS ; *d != 0 ; ++d) - { - printf("Rendering main icon @%dx%d\n", *d, *d); - fflush(stdout); - - snprintf(command, 2048, "%dx%d/apps/metaforce.png", *d, *d); - FILE* fp = fopen(command, "rb"); - if (!fp) - { - fprintf(stderr, "unable to open '%s' for reading\n", command); - fclose(ofp); - return 1; - } - - char header[8]; - fread(header, 1, 8, fp); - if (png_sig_cmp((png_const_bytep)header, 0, 8)) - { - fprintf(stderr, "invalid PNG signature in '%s'\n", command); - fclose(fp); - fclose(ofp); - return 1; - } - - png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!pngRead) - { - fprintf(stderr, "unable to initialize libpng\n"); - fclose(fp); - fclose(ofp); - return 1; - } - png_infop info = png_create_info_struct(pngRead); - if (!info) - { - fprintf(stderr, "unable to initialize libpng info\n"); - fclose(fp); - fclose(ofp); - return 1; - } - - if (setjmp(png_jmpbuf(pngRead))) - { - fprintf(stderr, "unable to initialize libpng I/O for '%s'\n", command); - fclose(fp); - fclose(ofp); - return 1; - } - - png_init_io(pngRead, fp); - png_set_sig_bytes(pngRead, 8); - - png_read_info(pngRead, info); - - png_uint_32 width = png_get_image_width(pngRead, info); - png_uint_32 height = png_get_image_height(pngRead, info); - png_byte colorType = png_get_color_type(pngRead, info); - png_byte bitDepth = png_get_bit_depth(pngRead, info); - - if (colorType != PNG_COLOR_TYPE_RGB_ALPHA) - { - fprintf(stderr, "'%s' is not in RGBA color mode\n", command); - fclose(fp); - fclose(ofp); - return 1; - } - - if (bitDepth != 8) - { - fprintf(stderr, "'%s' is not 8 bits-per-channel\n", command); - fclose(fp); - fclose(ofp); - return 1; - } - - if (setjmp(png_jmpbuf(pngRead))) - { - fprintf(stderr, "unable to read image in '%s'\n", command); - fclose(fp); - fclose(ofp); - return 1; - } - - unsigned long lWidth = width; - unsigned long lHeight = height; - fwrite(&lWidth, 1, sizeof(lWidth), ofp); - fwrite(&lHeight, 1, sizeof(lHeight), ofp); - for (png_uint_32 r=0 ; r