mirror of https://github.com/zeldaret/botw.git
ksys/phys: Add some prerequisites for ContactInfoTable
This commit is contained in:
parent
70aaa429fe
commit
d10dd65dcd
|
|
@ -79377,8 +79377,8 @@ Address,Quality,Size,Name
|
|||
0x0000007100e940bc,U,000092,NPCBase::m3
|
||||
0x0000007100e94118,O,000028,_ZN4ksys4phys13isSensorLayerENS0_12ContactLayerE
|
||||
0x0000007100e94134,O,000044,_ZN4ksys4phys20makeContactLayerMaskENS0_12ContactLayerE
|
||||
0x0000007100e94160,U,000016,
|
||||
0x0000007100e94170,U,000040,
|
||||
0x0000007100e94160,O,000016,_ZN4ksys4phys19getContactLayerBaseENS0_16ContactLayerTypeE
|
||||
0x0000007100e94170,O,000040,_ZN4ksys4phys32getContactLayerBaseRelativeValueENS0_12ContactLayerE
|
||||
0x0000007100e94198,O,000004,_ZN4ksys4phys18contactLayerToTextENS0_12ContactLayerE
|
||||
0x0000007100e9419c,O,000288,_ZN4ksys4phys20contactLayerFromTextERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100e942bc,O,000004,_ZN4ksys4phys14materialToTextENS0_8MaterialE
|
||||
|
|
@ -95439,14 +95439,14 @@ Address,Quality,Size,Name
|
|||
0x00000071012b2134,O,000864,_ZN4ksys4phys10SystemDataD1Ev
|
||||
0x00000071012b2494,O,000404,_ZN4sead9SafeArrayIN4ksys4phys10SystemData6TablesINS2_14LayerTableInfoELi32EEELi2EED2Ev
|
||||
0x00000071012b2628,O,000036,_ZN4ksys4phys10SystemDataD0Ev
|
||||
0x00000071012b264c,U,000368,physSystemData::x
|
||||
0x00000071012b264c,O,000368,_ZN4ksys4phys10SystemData4loadEPN4sead4HeapEPNS0_10LayerTableES6_PNS0_13MaterialTableEPNS0_16ContactInfoTableE
|
||||
0x00000071012b27bc,U,000544,
|
||||
0x00000071012b29dc,O,000316,_ZN4ksys4phys10SystemData22loadCharacterCtrlTableEPN4sead4HeapE
|
||||
0x00000071012b2b18,O,000292,_ZN4ksys4phys10SystemData22loadRagdollCtrlKeyListEPN4sead4HeapE
|
||||
0x00000071012b2c3c,O,000284,_ZN4ksys4phys10SystemData17loadLayerTableResERKNS1_6TablesINS0_14LayerTableInfoELi32EEENS1_14LayerTableTypeE
|
||||
0x00000071012b2c3c,O,000284,_ZN4ksys4phys10SystemData17loadLayerTableResERKNS1_6TablesINS0_14LayerTableInfoELi32EEENS0_16ContactLayerTypeE
|
||||
0x00000071012b2d58,O,000260,_ZN4ksys4phys10SystemData20loadMaterialTableResEv
|
||||
0x00000071012b2e5c,O,000260,_ZN4ksys4phys10SystemData23loadSubMaterialTableResEv
|
||||
0x00000071012b2f60,O,000304,_ZN4ksys4phys10SystemData23loadContactInfoTableResENS1_14LayerTableTypeE
|
||||
0x00000071012b2f60,O,000304,_ZN4ksys4phys10SystemData23loadContactInfoTableResENS0_16ContactLayerTypeE
|
||||
0x00000071012b3090,O,000260,_ZN4ksys4phys10SystemData25loadCharacterCtrlTableResEv
|
||||
0x00000071012b3194,U,000164,_ZN4ksys4phys14LayerTableInfo9postRead_Ev
|
||||
0x00000071012b3238,O,000160,_ZN4ksys4phys14LayerTableInfoD2Ev
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -22,6 +22,8 @@ target_sources(uking PRIVATE
|
|||
System/physConstraint.h
|
||||
System/physContactInfoParam.cpp
|
||||
System/physContactInfoParam.h
|
||||
System/physContactInfoTable.cpp
|
||||
System/physContactInfoTable.h
|
||||
System/physDefines.cpp
|
||||
System/physDefines.h
|
||||
System/physMaterialTable.cpp
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Physics/System/physContactInfoTable.h"
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <agl/Utils/aglResParameter.h>
|
||||
#include "KingSystem/Physics/System/physDefines.h"
|
||||
|
||||
namespace sead {
|
||||
class Heap;
|
||||
}
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
// FIXME
|
||||
class ContactInfoTable {
|
||||
public:
|
||||
ContactInfoTable();
|
||||
virtual ~ContactInfoTable();
|
||||
|
||||
void init(sead::Heap* heap);
|
||||
|
||||
void load(sead::Heap* heap, agl::utl::ResParameterArchive archive, ContactLayerType type);
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
@ -12,6 +12,17 @@ u32 makeContactLayerMask(ContactLayer layer) {
|
|||
return 1 << (layer - ContactLayer::SensorObject);
|
||||
}
|
||||
|
||||
u32 getContactLayerBase(ContactLayerType type) {
|
||||
if (type == ContactLayerType::Entity)
|
||||
return ContactLayer::EntityObject;
|
||||
return ContactLayer::SensorObject;
|
||||
}
|
||||
|
||||
u32 getContactLayerBaseRelativeValue(ContactLayer layer) {
|
||||
return layer - (layer < ContactLayer::SensorObject ? ContactLayer::EntityObject :
|
||||
ContactLayer::SensorObject);
|
||||
}
|
||||
|
||||
const char* contactLayerToText(ContactLayer layer) {
|
||||
return layer.text();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
namespace ksys::phys {
|
||||
|
||||
enum class ContactLayerType {
|
||||
Entity,
|
||||
Sensor,
|
||||
};
|
||||
|
||||
SEAD_ENUM(ContactLayer,
|
||||
EntityObject,\
|
||||
EntitySmallObject,\
|
||||
|
|
@ -161,7 +166,8 @@ enum class MotionType {
|
|||
|
||||
bool isSensorLayer(ContactLayer layer);
|
||||
u32 makeContactLayerMask(ContactLayer layer);
|
||||
|
||||
u32 getContactLayerBase(ContactLayerType type);
|
||||
u32 getContactLayerBaseRelativeValue(ContactLayer layer);
|
||||
const char* contactLayerToText(ContactLayer layer);
|
||||
ContactLayer contactLayerFromText(const sead::SafeString& text);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "KingSystem/Physics/System/physSystemData.h"
|
||||
#include "KingSystem/Physics/System/physContactInfoTable.h"
|
||||
#include "KingSystem/Physics/System/physMaterialTable.h"
|
||||
#include "KingSystem/Physics/System/physRagdollControllerKeyList.h"
|
||||
#include "KingSystem/Resource/resHandle.h"
|
||||
|
|
@ -38,12 +39,12 @@ SystemData::~SystemData() {
|
|||
void SystemData::load(sead::Heap* heap, LayerTable* entity_layer_table,
|
||||
LayerTable* sensor_layer_table, MaterialTable* material_table,
|
||||
ContactInfoTable* contact_info_table) {
|
||||
loadLayerTable(heap, entity_layer_table, LayerTableType::Entity);
|
||||
loadLayerTable(heap, sensor_layer_table, LayerTableType::Sensor);
|
||||
loadLayerTable(heap, entity_layer_table, ContactLayerType::Entity);
|
||||
loadLayerTable(heap, sensor_layer_table, ContactLayerType::Sensor);
|
||||
loadMaterialTable(heap, material_table);
|
||||
loadSubMaterialTable(heap, material_table);
|
||||
loadContactInfoTable(heap, contact_info_table, LayerTableType::Entity);
|
||||
loadContactInfoTable(heap, contact_info_table, LayerTableType::Sensor);
|
||||
loadContactInfoTable(heap, contact_info_table, ContactLayerType::Entity);
|
||||
loadContactInfoTable(heap, contact_info_table, ContactLayerType::Sensor);
|
||||
loadCharacterCtrlTable(heap);
|
||||
loadRagdollCtrlKeyList(heap);
|
||||
}
|
||||
|
|
@ -54,6 +55,19 @@ void SystemData::loadMaterialTable(sead::Heap* heap, MaterialTable* table) {
|
|||
table->loadMaterialTable(heap, res);
|
||||
}
|
||||
|
||||
void SystemData::loadSubMaterialTable(sead::Heap* heap, MaterialTable* table) {
|
||||
mSubMaterialTableHandle = new (heap) res::Handle;
|
||||
const auto res = loadSubMaterialTableRes();
|
||||
table->loadSubMaterialTable(heap, res);
|
||||
}
|
||||
|
||||
void SystemData::loadContactInfoTable(sead::Heap* heap, ContactInfoTable* table,
|
||||
ContactLayerType type) {
|
||||
mContactInfoTableHandles[int(type)] = new (heap) res::Handle;
|
||||
const auto res = loadContactInfoTableRes(type);
|
||||
table->load(heap, res, type);
|
||||
}
|
||||
|
||||
void SystemData::loadCharacterCtrlTable(sead::Heap* heap) {
|
||||
mCharacterCtrlTable.addList("CharacterControllerTable");
|
||||
|
||||
|
|
@ -83,15 +97,15 @@ void SystemData::loadRagdollCtrlKeyList(sead::Heap* heap) {
|
|||
|
||||
agl::utl::ResParameterArchive
|
||||
SystemData::loadLayerTableRes(const SystemData::LayerTableInfoContainer& container,
|
||||
SystemData::LayerTableType type) {
|
||||
ContactLayerType type) {
|
||||
res::LoadRequest request;
|
||||
request.mRequester = "physSystemData";
|
||||
const char* path{};
|
||||
switch (type) {
|
||||
case LayerTableType::Entity:
|
||||
case ContactLayerType::Entity:
|
||||
path = "Physics/System/EntityLayerTable.bphyslayer";
|
||||
break;
|
||||
case LayerTableType::Sensor:
|
||||
case ContactLayerType::Sensor:
|
||||
path = "Physics/System/SensorLayerTable.bphyslayer";
|
||||
break;
|
||||
}
|
||||
|
|
@ -118,15 +132,15 @@ agl::utl::ResParameterArchive SystemData::loadSubMaterialTableRes() {
|
|||
return agl::utl::ResParameterArchive{direct_resource->getRawData()};
|
||||
}
|
||||
|
||||
agl::utl::ResParameterArchive SystemData::loadContactInfoTableRes(SystemData::LayerTableType type) {
|
||||
agl::utl::ResParameterArchive SystemData::loadContactInfoTableRes(ContactLayerType type) {
|
||||
res::LoadRequest request;
|
||||
request.mRequester = "physSystemData";
|
||||
const char* path{};
|
||||
switch (type) {
|
||||
case LayerTableType::Entity:
|
||||
case ContactLayerType::Entity:
|
||||
path = "Physics/System/EntityContactInfoTable.bphyscontact";
|
||||
break;
|
||||
case LayerTableType::Sensor:
|
||||
case ContactLayerType::Sensor:
|
||||
path = "Physics/System/SensorContactInfoTable.bphyscontact";
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,25 +67,20 @@ public:
|
|||
MaterialTable* material_table, ContactInfoTable* contact_info_table);
|
||||
|
||||
private:
|
||||
enum class LayerTableType {
|
||||
Entity,
|
||||
Sensor,
|
||||
};
|
||||
|
||||
using LayerTableInfoContainer = Tables<LayerTableInfo, NumLayers>;
|
||||
|
||||
void loadLayerTable(sead::Heap* heap, LayerTable* table, LayerTableType type);
|
||||
void loadLayerTable(sead::Heap* heap, LayerTable* table, ContactLayerType type);
|
||||
void loadMaterialTable(sead::Heap* heap, MaterialTable* table);
|
||||
void loadSubMaterialTable(sead::Heap* heap, MaterialTable* table);
|
||||
void loadContactInfoTable(sead::Heap* heap, ContactInfoTable* table, LayerTableType type);
|
||||
void loadContactInfoTable(sead::Heap* heap, ContactInfoTable* table, ContactLayerType type);
|
||||
void loadCharacterCtrlTable(sead::Heap* heap);
|
||||
void loadRagdollCtrlKeyList(sead::Heap* heap);
|
||||
|
||||
agl::utl::ResParameterArchive loadLayerTableRes(const LayerTableInfoContainer& container,
|
||||
LayerTableType type);
|
||||
ContactLayerType type);
|
||||
agl::utl::ResParameterArchive loadMaterialTableRes();
|
||||
agl::utl::ResParameterArchive loadSubMaterialTableRes();
|
||||
agl::utl::ResParameterArchive loadContactInfoTableRes(LayerTableType type);
|
||||
agl::utl::ResParameterArchive loadContactInfoTableRes(ContactLayerType type);
|
||||
agl::utl::ResParameterArchive loadCharacterCtrlTableRes();
|
||||
|
||||
sead::SafeArray<LayerTableInfoContainer, 2> mLayerTableInfo{};
|
||||
|
|
|
|||
Loading…
Reference in New Issue