summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System/physMaterialTable.h
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-10-28 20:48:35 +0200
committerLéo Lam <leo@leolam.fr>2021-10-30 12:17:26 +0200
commit70aaa429fe82098d954d0945bfb1b8253a7fa45a (patch)
tree7a7d8e94b3a905831c6f06c4e6449cf08ad32245 /src/KingSystem/Physics/System/physMaterialTable.h
parent5580b4934565823844a7fa02ad0eb62cc7e3ab55 (diff)
ksys/phys: Start adding SystemData
- SystemData (WIP) - MaterialTable (should be complete)
Diffstat (limited to 'src/KingSystem/Physics/System/physMaterialTable.h')
-rw-r--r--src/KingSystem/Physics/System/physMaterialTable.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/KingSystem/Physics/System/physMaterialTable.h b/src/KingSystem/Physics/System/physMaterialTable.h
new file mode 100644
index 00000000..04240b0d
--- /dev/null
+++ b/src/KingSystem/Physics/System/physMaterialTable.h
@@ -0,0 +1,67 @@
+#pragma once
+
+#include <agl/Utils/aglParameter.h>
+#include <agl/Utils/aglParameterIO.h>
+#include <agl/Utils/aglParameterList.h>
+#include <agl/Utils/aglParameterObj.h>
+#include <agl/Utils/aglResParameter.h>
+#include <container/seadSafeArray.h>
+#include "KingSystem/Physics/System/physDefines.h"
+#include "KingSystem/Utils/Types.h"
+
+namespace ksys::phys {
+
+class MaterialTable {
+public:
+ struct Values : agl::utl::IParameterObj {
+ sead::SafeArray<agl::utl::Parameter<sead::Vector2f>, Material::size()> values;
+ };
+ KSYS_CHECK_SIZE_NX150(Values, 0x4b0);
+
+ struct SubValues : agl::utl::IParameterObj {
+ sead::SafeArray<agl::utl::Parameter<sead::FixedSafeString<32>>, 12> values;
+ int num_values;
+ };
+ KSYS_CHECK_SIZE_NX150(SubValues, 0x3f8);
+
+ MaterialTable();
+ virtual ~MaterialTable();
+
+ void loadMaterialTable(sead::Heap* heap, agl::utl::ResParameterArchive archive);
+ void loadSubMaterialTable(sead::Heap* heap, agl::utl::ResParameterArchive archive);
+
+ const sead::SafeString& getSubMaterial(Material material, int submat_idx) const;
+ const sead::SafeString& getSoundMatchingSubMaterial(Material material, int submat_idx) const;
+
+ int getSubMaterialIdx(Material material, const sead::SafeString& submat_name) const;
+ int getSoundSubMaterialIdx(Material material, const sead::SafeString& submat_name) const;
+
+ int getNumSubMaterials(Material material) const;
+ bool subMaterialHasSound(Material material, int submat_idx) const;
+
+private:
+ void addMaterialTableList(const char* name) {
+ mMaterialTablePIO.addList(&mMaterialTablePList, name);
+ }
+
+ void addSubMaterialTableList(const char* name) {
+ mSubMaterialTablePIO.addList(&mSubMaterialTablePList, name);
+ }
+
+ agl::utl::IParameterIO mMaterialTablePIO;
+ agl::utl::ParameterList mMaterialTablePList;
+ sead::SafeArray<Values, Material::size()> mMaterialTable;
+
+ agl::utl::IParameterIO mSubMaterialTablePIO;
+ agl::utl::ParameterList mSubMaterialTablePList;
+ sead::SafeArray<SubValues, Material::size()> mSubMaterialTable;
+
+ agl::utl::ParameterList mSoundSubMaterialTablePList;
+ sead::SafeArray<SubValues, Material::size()> mSoundSubMaterialTable;
+
+ agl::utl::ParameterList mSoundMatchingSubMaterialTablePList;
+ sead::SafeArray<SubValues, Material::size()> mSoundMatchingSubMaterialTable;
+};
+KSYS_CHECK_SIZE_NX150(MaterialTable, 0x25a28);
+
+} // namespace ksys::phys