diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 7a71d886..ffadb7b5 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -52939,7 +52939,7 @@ 0x000000710089cc88,ActorCaptureMgr::init,332,_ZN4ksys3act15ActorCaptureMgr4initERKNS1_7InitArgE 0x000000710089cdd4,ActorCaptureMgr::init2,12,_ZN4ksys3act15ActorCaptureMgr9setCameraEPNS0_6CameraE 0x000000710089cde0,sub_710089CDE0,4112, -0x000000710089ddf0,_ZN4sead21FormatFixedSafeStringILi1024EEC2EPKcz,224, +0x000000710089ddf0,_ZN4sead21FormatFixedSafeStringILi1024EEC2EPKcz,224,_ZN4sead21FormatFixedSafeStringILi1024EEC2EPKcz 0x000000710089ded0,sub_710089DED0,572, 0x000000710089e10c,sub_710089E10C,804, 0x000000710089e430,sub_710089E430,1028, @@ -75118,22 +75118,22 @@ 0x0000007100d97abc,sub_7100D97ABC,64, 0x0000007100d97afc,_ZN3aal19SpatialPlayingParamD0Ev,60, 0x0000007100d97b38,sub_7100D97B38,364, -0x0000007100d97ca4,sub_7100D97CA4,100, -0x0000007100d97d08,sub_7100D97D08,108, -0x0000007100d97d74,Chmres::createInstance,324, -0x0000007100d97eb8,_ZN6xlink211SystemELink14deleteInstanceEv,88, -0x0000007100d97f10,sub_7100D97F10,264, -0x0000007100d98018,sub_7100D98018,36, -0x0000007100d9803c,Chmres::c,704, -0x0000007100d982fc,_ZNK3agl3env10CubeMapMgr22searchIlluminantEntityERKN4sead14SafeStringBaseIcEE,296, -0x0000007100d98424,_ZNK3agl3env10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296, -0x0000007100d9854c,_ZNK2al10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296, -0x0000007100d98674,sub_7100D98674,36, -0x0000007100d98698,j__ZdlPv_867,4, -0x0000007100d9869c,Chmres::Material::c,2232, -0x0000007100d98f54,_ZN4sead19FixedSafeStringBaseIcLi47EEaSERKNS_14SafeStringBaseIcEE,400, -0x0000007100d990e4,sub_7100D990E4,136, -0x0000007100d9916c,j__ZdlPv_868,4, +0x0000007100d97ca4,sub_7100D97CA4,100,_ZN4ksys3chm12SystemConfig18SingletonDisposer_D1Ev +0x0000007100d97d08,sub_7100D97D08,108,_ZN4ksys3chm12SystemConfig18SingletonDisposer_D0Ev +0x0000007100d97d74,Chmres::createInstance,324,_ZN4ksys3chm12SystemConfig14createInstanceEPN4sead4HeapE +0x0000007100d97eb8,_ZN4ksys3chm12SystemConfig14deleteInstanceEv,88,_ZN4ksys3chm12SystemConfig14deleteInstanceEv +0x0000007100d97f10,sub_7100D97F10,264,_ZN4ksys3chm12SystemConfigD1Ev +0x0000007100d98018,sub_7100D98018,36,_ZN4ksys3chm12SystemConfigD0Ev +0x0000007100d9803c,Chmres::c,704,_ZN4ksys3chm12SystemConfig4initEPN4sead4HeapE +0x0000007100d982fc,_ZNK3agl3env10CubeMapMgr22searchIlluminantEntityERKN4sead14SafeStringBaseIcEE,296,_ZNK4ksys3chm12SystemConfig8getWorldERKN4sead14SafeStringBaseIcEE +0x0000007100d98424,_ZNK3agl3env10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296,_ZNK4ksys3chm12SystemConfig11getMaterialERKN4sead14SafeStringBaseIcEE +0x0000007100d9854c,_ZNK2al10CubeMapMgr23searchIlluminantTextureERKN4sead14SafeStringBaseIcEE,296,_ZNK4ksys3chm12SystemConfig10getElementERKN4sead14SafeStringBaseIcEE +0x0000007100d98674,sub_7100D98674,36,_ZN4ksys3chm12SystemConfig4ListD2Ev +0x0000007100d98698,j__ZdlPv_867,4,_ZN4ksys3chm12SystemConfig4ListD0Ev +0x0000007100d9869c,Chmres::Material::c,2232,_ZN4ksys3chm12SystemConfig5WorldC1Ev +0x0000007100d98f54,_ZN4sead19FixedSafeStringBaseIcLi47EEaSERKNS_14SafeStringBaseIcEE,400,_ZN3agl3utl9ParameterIN4sead15FixedSafeStringILi256EEEEC1ERKS4_RKNS2_14SafeStringBaseIcEESB_PNS0_13IParameterObjE? +0x0000007100d990e4,sub_7100D990E4,136,_ZN4ksys3chm12SystemConfig5WorldD1Ev +0x0000007100d9916c,j__ZdlPv_868,4,_ZN4ksys3chm12SystemConfig5WorldD0Ev 0x0000007100d99170,sub_7100D99170,100, 0x0000007100d991d4,sub_7100D991D4,108, 0x0000007100d99240,Chemical::createInstance,180, @@ -94356,12 +94356,12 @@ 0x0000007101265a6c,sub_7101265A6C,64, 0x0000007101265aac,nullsub_4745,4, 0x0000007101265ab0,j__ZdlPv_1265,4, -0x0000007101265ab4,Chmres::Material::b,1460, -0x0000007101266068,sub_7101266068,96, -0x00000071012660c8,j__ZdlPv_1266,4, -0x00000071012660cc,Chmres::Material::a,3380, -0x0000007101266e00,sub_7101266E00,124, -0x0000007101266e7c,j__ZdlPv_1267,4, +0x0000007101265ab4,Chmres::Material::b,1460,_ZN4ksys3chm12SystemConfig7ElementC1Ev +0x0000007101266068,sub_7101266068,96,_ZN4ksys3chm12SystemConfig7ElementD1Ev +0x00000071012660c8,j__ZdlPv_1266,4,_ZN4ksys3chm12SystemConfig7ElementD0Ev +0x00000071012660cc,Chmres::Material::a,3380,_ZN4ksys3chm12SystemConfig8MaterialC1Ev +0x0000007101266e00,sub_7101266E00,124,_ZN4ksys3chm12SystemConfig8MaterialD1Ev +0x0000007101266e7c,j__ZdlPv_1267,4,_ZN4ksys3chm12SystemConfig8MaterialD0Ev 0x0000007101266e80,sub_7101266E80,24, 0x0000007101266e98,nullsub_4746,4, 0x0000007101266e9c,j__ZdlPv_1268,4, diff --git a/src/KingSystem/Chemical/CMakeLists.txt b/src/KingSystem/Chemical/CMakeLists.txt index 69886275..dc1ac764 100644 --- a/src/KingSystem/Chemical/CMakeLists.txt +++ b/src/KingSystem/Chemical/CMakeLists.txt @@ -5,4 +5,7 @@ target_sources(uking PRIVATE chmRoot.h chmShape.cpp chmShape.h + chmSystemConfig.cpp + chmSystemConfig.h + chmSystemConfigObjs.cpp ) diff --git a/src/KingSystem/Chemical/chmSystemConfig.cpp b/src/KingSystem/Chemical/chmSystemConfig.cpp new file mode 100644 index 00000000..7ebda510 --- /dev/null +++ b/src/KingSystem/Chemical/chmSystemConfig.cpp @@ -0,0 +1,53 @@ +#include "KingSystem/Chemical/chmSystemConfig.h" + +namespace ksys::chm { + +SEAD_SINGLETON_DISPOSER_IMPL(SystemConfig) + +SystemConfig::~SystemConfig() { + mMaterials.freeBuffer(); + mWorlds.freeBuffer(); +} + +void SystemConfig::init(sead::Heap* heap) { + mMaterials.allocBufferAssert(128, heap); + mElements.allocBufferAssert(128, heap); + mWorlds.allocBufferAssert(8, heap); + + addList(&mWorldList, "world"); + addList(&mMaterialList, "material"); + addList(&mElementList, "element"); + + for (auto it = mWorlds.begin(), end = mWorlds.end(); it != end; ++it) + mWorldList.addObj(&*it, sead::FormatFixedSafeString<1024>("%d", it.getIndex())); + for (auto it = mMaterials.begin(), end = mMaterials.end(); it != end; ++it) + mMaterialList.addObj(&*it, sead::FormatFixedSafeString<1024>("%d", it.getIndex())); + for (auto it = mElements.begin(), end = mElements.end(); it != end; ++it) + mElementList.addObj(&*it, sead::FormatFixedSafeString<1024>("%d", it.getIndex())); +} + +const SystemConfig::World& SystemConfig::getWorld(const sead::SafeString& name) const { + for (auto it = mWorlds.begin(), end = mWorlds.end(); it != end; ++it) { + if (name == it->id.ref()) + return *it; + } + return mDummyWorld; +} + +const SystemConfig::Material& SystemConfig::getMaterial(const sead::SafeString& name) const { + for (auto it = mMaterials.begin(), end = mMaterials.end(); it != end; ++it) { + if (name == it->id.ref()) + return *it; + } + return mDummyMaterial; +} + +const SystemConfig::Element& SystemConfig::getElement(const sead::SafeString& name) const { + for (auto it = mElements.begin(), end = mElements.end(); it != end; ++it) { + if (name == it->name.ref()) + return *it; + } + return mDummyElement; +} + +} // namespace ksys::chm diff --git a/src/KingSystem/Chemical/chmSystemConfig.h b/src/KingSystem/Chemical/chmSystemConfig.h new file mode 100644 index 00000000..ff7cf1ab --- /dev/null +++ b/src/KingSystem/Chemical/chmSystemConfig.h @@ -0,0 +1,116 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace ksys::chm { + +class SystemConfig : public agl::utl::IParameterIO, public sead::hostio::Node { + SEAD_SINGLETON_DISPOSER(SystemConfig) + SystemConfig() : agl::utl::IParameterIO("chmres", 0) {} + ~SystemConfig() override; + +public: + struct Element : agl::utl::IParameterObj, sead::hostio::Node { + Element(); + ~Element() override; + + agl::utl::Parameter> name; + agl::utl::Parameter> label; + agl::utl::Parameter effect_type; + agl::utl::Parameter attribute; + agl::utl::Parameter life_frames; + agl::utl::Parameter temperature; + agl::utl::Parameter type; + agl::utl::Parameter wetting_rate; + agl::utl::Parameter wind_speed; + agl::utl::Parameter electric_charge; + agl::utl::Parameter shock_wave_speed; + agl::utl::Parameter fire_level; + agl::utl::Parameter moisture; + }; + + struct Material : agl::utl::IParameterObj, sead::hostio::Node { + Material(); + ~Material() override; + + agl::utl::Parameter> id; + agl::utl::Parameter> label; + agl::utl::Parameter attribute; + agl::utl::Parameter heat_capacity; + agl::utl::Parameter thermal_conductivity; + agl::utl::Parameter electrical_resistivity; + agl::utl::Parameter electrical_capacitance; + agl::utl::Parameter electromotive_force; + agl::utl::Parameter fire_proof_level; + agl::utl::Parameter ignition_point; + agl::utl::Parameter burn_speed; + agl::utl::Parameter wetting_amount; + agl::utl::Parameter wind_force_remain_rate; + agl::utl::Parameter> burn_res_element_name; + agl::utl::Parameter> warm_res_element_name; + agl::utl::Parameter> exp_res_element_name; + agl::utl::Parameter> exp_res_element_name1; + agl::utl::Parameter> electricity_res_element_name; + agl::utl::Parameter> ice_magic_res_element_name; + agl::utl::Parameter> water_res_element_name; + }; + + struct World : agl::utl::IParameterObj, sead::hostio::Node { + World(); + ~World() override; + + agl::utl::Parameter> id; + agl::utl::Parameter> label; + agl::utl::Parameter evaporation_speed_rate; + agl::utl::Parameter heat_transfer_speed_rate; + agl::utl::Parameter fire_heat_transfer_speed_rate; + agl::utl::Parameter conduction_speed_rate_log; + agl::utl::Parameter burn_speed_rate; + agl::utl::Parameter fire_extra_radius; + agl::utl::Parameter player_fire_margin; + agl::utl::Parameter electricity_extra_radius_rate; + agl::utl::Parameter electric_water_extra_radius_rate; + agl::utl::Parameter min_ice_size; + agl::utl::Parameter ice_heat_cheat_threshold; + agl::utl::Parameter ice_heat_cheat_rate; + agl::utl::Parameter ice_melt_ratio_env_temp; + agl::utl::Parameter ice_melt_ratio_warm_air; + agl::utl::Parameter ice_melt_ratio_fire; + agl::utl::Parameter ice_melt_ratio_fire2; + agl::utl::Parameter wind_lift_rate; + agl::utl::Parameter lightning_distance; + agl::utl::Parameter character_ignition_count; + agl::utl::Parameter object_ignition_count; + agl::utl::Parameter offensive_rigid_radius; + }; + + struct List : agl::utl::IParameterList, sead::hostio::Node { + ~List() override { ; } + }; + + void init(sead::Heap* heap); + + const World& getWorld(const sead::SafeString& name) const; + const Material& getMaterial(const sead::SafeString& name) const; + const Element& getElement(const sead::SafeString& name) const; + +private: + sead::Buffer mMaterials; + sead::Buffer mElements; + sead::Buffer mWorlds; + Material mDummyMaterial; + Element mDummyElement; + World mDummyWorld; + List mWorldList; + List mMaterialList; + List mElementList; +}; + +} // namespace ksys::chm diff --git a/src/KingSystem/Chemical/chmSystemConfigObjs.cpp b/src/KingSystem/Chemical/chmSystemConfigObjs.cpp new file mode 100644 index 00000000..001a8984 --- /dev/null +++ b/src/KingSystem/Chemical/chmSystemConfigObjs.cpp @@ -0,0 +1,75 @@ +#include "KingSystem/Chemical/chmSystemConfig.h" + +namespace ksys::chm { + +SystemConfig::Element::Element() + : name({"----"}, "name", "ID", this), label({"名称未設定"}, "label", "名前", this), + effect_type(0, "effect_type", "エフェクトタイプ", this), + attribute(0, "attribute", "ビットフラグ", this), + life_frames(0.0, "life_frames", "寿命(フレーム)", "Min=0.0 ,Max=300", this), + temperature(0.0, "temperature", "温度", this), type(2, "type", "タイプ", this), + wetting_rate(0.0, "wetting_rate", "濡れ率", this), + wind_speed(0.0, "wind_speed", "風速", this), + electric_charge(0.0, "electric_charge", "電荷", this), + shock_wave_speed(0.0, "shock_wave_speed", "衝撃波の速度", this), + fire_level(2, "fire_level", "炎レベル", this), moisture(0.0, "moisture", "湿度", this) {} + +SystemConfig::Element::~Element() = default; + +SystemConfig::Material::Material() + : id({"untitled"}, "id", "ID", this), label({"名称未設定材質"}, "label", "名前", this), + attribute(0, "attribute", "属性フラグ", this), + heat_capacity(1.0, "heat_capacity", "比熱容量[J/gK]", "Min=0, Max=10", this), + thermal_conductivity(1.0, "thermal_conductivity", "熱伝導率[W/m・K]", "Min=0, Max=100", this), + electrical_resistivity(1.0, "electrical_resistivity", "電気抵抗率[Ω・m]", "Min=-10, Max=10", + this), + electrical_capacitance(1.0, "electrical_capacitance", "静電容量[F]", "Min=0, Max=1", this), + electromotive_force(0.0, "electromotive_force", "起電力[V]", "Min=0, Max=10", this), + fire_proof_level(0, "fire_proof_level", "耐火性能[Lv]", "Min=0, Max=5", this), + ignition_point(100.0, "ignition_point", "発火点(度)", "Min=0 ,Max=1000", this), + burn_speed(1.0, "burn_speed", "燃える速度", "Min=0 ,Max=1.0", this), + wetting_amount(1.0, "wetting_amount", "単位面積あたりの塗れ量[kg/m2]", "Min=0, Max=100", + this), + wind_force_remain_rate(0.0, "wind_force_remain_rate", "風力影響の残り率", "Min=0,Max=1", + this), + burn_res_element_name({"----"}, "burn_res_element_name", "炎", this), + warm_res_element_name({"----"}, "warm_res_element_name", "暖気", this), + exp_res_element_name({"----"}, "exp_res_element_name", "爆発(slot0)", this), + exp_res_element_name1({"----"}, "exp_res_element_name1", "爆発(slot1)", this), + electricity_res_element_name({"----"}, "electricity_res_element_name", "帯電", this), + ice_magic_res_element_name({"----"}, "ice_magic_res_element_name", "氷魔法", this), + water_res_element_name({"----"}, "water_res_element_name", "水", this) {} + +SystemConfig::Material::~Material() = default; + +SystemConfig::World::World() + : id({"untitled"}, "id", "ID", this), label({"名称未設定"}, "label", "ラベル", this), + evaporation_speed_rate(24.0, "evaporation_speed_rate", "温度に対する蒸発係数", + "Min=0 ,Max=100", this), + heat_transfer_speed_rate(24.0, "heat_transfer_speed_rate", "伝熱速度倍率(全体)", this), + fire_heat_transfer_speed_rate(2.0, "fire_heat_transfer_speed_rate", "伝熱速度倍率(炎)", this), + conduction_speed_rate_log(-5.0, "conduction_speed_rate_log", "電気伝導速度倍率", this), + burn_speed_rate(0.1, "burn_speed_rate", "燃焼速度倍率", this), + fire_extra_radius(0.3, "fire_extra_radius", "炎は何m離れてても当たるか", this), + player_fire_margin(0.3, "player_fire_margin", "プレイヤーの直火大丈夫距離[m]", this), + electricity_extra_radius_rate(50.0, "electricity_extra_radius_rate", "放電距離倍率", this), + electric_water_extra_radius_rate(500.0, "electric_water_extra_radius_rate", + "放電距離倍率(水の漏電)", this), + min_ice_size(0.15, "min_ice_size", "最少の氷サイズ[m]", this), + ice_heat_cheat_threshold(10000.0, "ice_heat_cheat_threshold", + "氷を溶けやすくするチートの発動重要[kg]", this), + ice_heat_cheat_rate(0.5, "ice_heat_cheat_rate", "氷を溶けやすくするチートの割合", this), + ice_melt_ratio_env_temp(0.05, "ice_melt_ratio_env_temp", "氷解率vs気温", this), + ice_melt_ratio_warm_air(0.5, "ice_melt_ratio_warm_air", "氷解率vs暖気", this), + ice_melt_ratio_fire(1.0, "ice_melt_ratio_fire", "氷解率vs火", this), + ice_melt_ratio_fire2(10.0, "ice_melt_ratio_fire2", "氷解率vs炎", this), + wind_lift_rate(0.1, "wind_lift_rate", "揚抗比", this), + lightning_distance(25.0, "lightning_distance", "落雷の範囲[m]", this), + character_ignition_count(90.0, "character_ignition_count", "キャラクタ着火時間(フレーム)", + this), + object_ignition_count(90.0, "object_ignition_count", "キャラクタ着火時間(フレーム)", this), + offensive_rigid_radius(1.0, "offensive_rigid_radius", "攻撃状態のケミカルサイズ", this) {} + +SystemConfig::World::~World() = default; + +} // namespace ksys::chm