1
This commit is contained in:
parent
d1ac2f3f54
commit
ed71405708
@ -179,7 +179,7 @@ namespace mt
|
|||||||
void Map::LoadWorldObjects()
|
void Map::LoadWorldObjects()
|
||||||
{
|
{
|
||||||
auto parse_func =
|
auto parse_func =
|
||||||
[] (std::shared_ptr<a8::XObject> node, WorldObject* obj)
|
[] (std::shared_ptr<a8::XObject> node, std::shared_ptr<WorldObject> obj)
|
||||||
{
|
{
|
||||||
obj->object_id = node->At("id")->AsXValue();
|
obj->object_id = node->At("id")->AsXValue();
|
||||||
auto bounds = node->At("bounds");
|
auto bounds = node->At("bounds");
|
||||||
@ -199,17 +199,19 @@ namespace mt
|
|||||||
{
|
{
|
||||||
auto thing = root.At("thing");
|
auto thing = root.At("thing");
|
||||||
for (int i = 0; i < thing->Size(); ++i) {
|
for (int i = 0; i < thing->Size(); ++i) {
|
||||||
auto& obj = a8::FastAppend(_world_objects);
|
auto obj = std::make_shared<WorldObject>();
|
||||||
obj.object_type = WorldObjectType_e::kBoxType;
|
obj->object_type = WorldObjectType_e::kBoxType;
|
||||||
parse_func(thing->At(i), &obj);
|
parse_func(thing->At(i), obj);
|
||||||
|
_world_objects.push_back(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto thing = root.At("loot");
|
auto thing = root.At("loot");
|
||||||
for (int i = 0; i < thing->Size(); ++i) {
|
for (int i = 0; i < thing->Size(); ++i) {
|
||||||
auto& obj = a8::FastAppend(_world_objects);
|
auto obj = std::make_shared<WorldObject>();
|
||||||
obj.object_type = WorldObjectType_e::kLootType;
|
obj->object_type = WorldObjectType_e::kLootType;
|
||||||
parse_func(thing->At(i), &obj);
|
parse_func(thing->At(i), obj);
|
||||||
|
_world_objects.push_back(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace mt
|
|||||||
glm::vec3 first_safearea_center_;
|
glm::vec3 first_safearea_center_;
|
||||||
std::map<int, int> car_num_limit_;
|
std::map<int, int> car_num_limit_;
|
||||||
std::vector<int> safearea_list;
|
std::vector<int> safearea_list;
|
||||||
std::vector<WorldObject> _world_objects;
|
std::vector<std::shared_ptr<WorldObject>> _world_objects;
|
||||||
MapCollider* collider_info = nullptr;
|
MapCollider* collider_info = nullptr;
|
||||||
|
|
||||||
std::string RandTemplate() const;
|
std::string RandTemplate() const;
|
||||||
|
@ -3725,13 +3725,13 @@ int Room::GetPolyExtFlag(int poly_idx)
|
|||||||
void Room::CreateWorldObjects()
|
void Room::CreateWorldObjects()
|
||||||
{
|
{
|
||||||
for (auto& obj : GetMapMeta()->_world_objects) {
|
for (auto& obj : GetMapMeta()->_world_objects) {
|
||||||
switch ((WorldObjectType_e)obj.object_type) {
|
switch ((WorldObjectType_e)obj->object_type) {
|
||||||
case WorldObjectType_e::kLootType:
|
case WorldObjectType_e::kLootType:
|
||||||
{
|
{
|
||||||
CreateLoot
|
CreateLoot
|
||||||
(
|
(
|
||||||
obj.object_id,
|
obj->object_id,
|
||||||
obj.pos,
|
obj->pos,
|
||||||
1,
|
1,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
@ -3741,10 +3741,10 @@ void Room::CreateWorldObjects()
|
|||||||
{
|
{
|
||||||
CreateObstacle
|
CreateObstacle
|
||||||
(
|
(
|
||||||
obj.object_id,
|
obj->object_id,
|
||||||
obj.pos.x,
|
obj->pos.x,
|
||||||
obj.pos.y,
|
obj->pos.y,
|
||||||
obj.pos.z
|
obj->pos.z
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3752,8 +3752,8 @@ void Room::CreateWorldObjects()
|
|||||||
{
|
{
|
||||||
CreateAndTakeonCar
|
CreateAndTakeonCar
|
||||||
(
|
(
|
||||||
obj.object_id,
|
obj->object_id,
|
||||||
obj.pos
|
obj->pos
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user