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");
|
|
|
|
while (!tableData.eof()) {
|
2023-08-11 04:27:40 +00:00
|
|
|
CDPhysicsComponent entry;
|
|
|
|
entry.id = tableData.getIntField("id", -1);
|
|
|
|
entry.bStatic = tableData.getIntField("static", -1) != 0;
|
|
|
|
entry.physicsAsset = tableData.getStringField("physics_asset", "");
|
2023-01-07 09:48:59 +00:00
|
|
|
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0);
|
|
|
|
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
|
2023-08-11 04:27:40 +00:00
|
|
|
entry.speed = tableData.getFloatField("speed", -1);
|
2023-01-07 09:48:59 +00:00
|
|
|
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
|
2023-08-11 04:27:40 +00:00
|
|
|
entry.playerHeight = tableData.getFloatField("playerHeight");
|
|
|
|
entry.playerRadius = tableData.getFloatField("playerRadius");
|
|
|
|
entry.pcShapeType = tableData.getIntField("pcShapeType");
|
|
|
|
entry.collisionGroup = tableData.getIntField("collisionGroup");
|
2023-01-07 09:48:59 +00:00
|
|
|
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed"));
|
|
|
|
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
|
|
|
|
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
|
|
|
|
UNUSED(entry->friction = tableData.getFloatField("friction"));
|
|
|
|
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-08-11 04:27:40 +00:00
|
|
|
m_entries.insert(std::make_pair(entry.id, entry));
|
2021-12-05 17:54:36 +00:00
|
|
|
tableData.nextRow();
|
|
|
|
}
|
|
|
|
|
|
|
|
tableData.finalize();
|
|
|
|
}
|
|
|
|
|
|
|
|
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
|
2023-08-11 04:27:40 +00:00
|
|
|
auto itr = m_entries.find(componentID);
|
|
|
|
return itr != m_entries.end() ? &itr->second : nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2023-01-07 09:48:59 +00:00
|
|
|
|