2021-12-05 17:54:36 +00:00
|
|
|
#include "CDPhysicsComponentTable.h"
|
|
|
|
|
2023-08-11 04:27:40 +00:00
|
|
|
void CDPhysicsComponentTable::LoadValuesFromDatabase() {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
|
2024-02-09 13:37:58 +00:00
|
|
|
auto& entries = GetEntriesMutable();
|
2021-12-05 17:54:36 +00:00
|
|
|
while (!tableData.eof()) {
|
2024-03-07 05:45:24 +00:00
|
|
|
const uint32_t componentID = tableData.getIntField("id", -1);
|
|
|
|
|
|
|
|
auto& entry = entries[componentID];
|
|
|
|
entry.id = componentID;
|
2023-08-11 04:27:40 +00:00
|
|
|
entry.bStatic = tableData.getIntField("static", -1) != 0;
|
|
|
|
entry.physicsAsset = tableData.getStringField("physics_asset", "");
|
2024-03-07 05:45:24 +00:00
|
|
|
UNUSED_COLUMN(entry.jump = tableData.getIntField("jump", -1) != 0;)
|
|
|
|
UNUSED_COLUMN(entry.doubleJump = tableData.getIntField("doublejump", -1) != 0;)
|
|
|
|
entry.speed = static_cast<float>(tableData.getFloatField("speed", -1));
|
|
|
|
UNUSED_COLUMN(entry.rotSpeed = tableData.getFloatField("rotSpeed", -1);)
|
|
|
|
entry.playerHeight = static_cast<float>(tableData.getFloatField("playerHeight"));
|
|
|
|
entry.playerRadius = static_cast<float>(tableData.getFloatField("playerRadius"));
|
2023-08-11 04:27:40 +00:00
|
|
|
entry.pcShapeType = tableData.getIntField("pcShapeType");
|
|
|
|
entry.collisionGroup = tableData.getIntField("collisionGroup");
|
2024-03-07 05:45:24 +00:00
|
|
|
UNUSED_COLUMN(entry.airSpeed = tableData.getFloatField("airSpeed");)
|
|
|
|
UNUSED_COLUMN(entry.boundaryAsset = tableData.getStringField("boundaryAsset");)
|
|
|
|
UNUSED_COLUMN(entry.jumpAirSpeed = tableData.getFloatField("jumpAirSpeed");)
|
|
|
|
UNUSED_COLUMN(entry.friction = tableData.getFloatField("friction");)
|
|
|
|
UNUSED_COLUMN(entry.gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset");)
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
tableData.nextRow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-07 05:45:24 +00:00
|
|
|
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(const uint32_t componentID) {
|
2024-02-09 13:37:58 +00:00
|
|
|
auto& entries = GetEntriesMutable();
|
|
|
|
auto itr = entries.find(componentID);
|
|
|
|
return itr != entries.end() ? &itr->second : nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2023-01-07 09:48:59 +00:00
|
|
|
|