1
This commit is contained in:
parent
690eff5142
commit
a7f08b469f
@ -235,6 +235,7 @@ enum EquipType_e
|
||||
EQUIP_TYPE_SPOILS = 12,
|
||||
EQUIP_TYPE_SINGAL_EMITTER = 13,
|
||||
EQUIP_TYPE_GIFT_PACKAGE = 14,
|
||||
EQUIP_TYPE_GEMSTONE = 15,
|
||||
EQUIP_TYPE_End
|
||||
};
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Creature : public MoveableEntity
|
||||
int shield_hp_ = 0;
|
||||
int shield_max_hp_ = 0;
|
||||
|
||||
int gemstone = 666;
|
||||
int gemstone = 0;
|
||||
|
||||
Creature();
|
||||
virtual ~Creature() override;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "mt/Map.h"
|
||||
#include "mt/MapCollider.h"
|
||||
#include "mt/SafeArea.h"
|
||||
#include "mt/MetaMgr.h"
|
||||
|
||||
IMPL_TABLE(mt::Map)
|
||||
|
||||
@ -119,6 +120,7 @@ namespace mt
|
||||
A8_ABORT();
|
||||
}
|
||||
collider_info = MapCollider::GetByName(map_collider());
|
||||
LoadWorldObjects();
|
||||
}
|
||||
|
||||
void Map::Init2()
|
||||
@ -174,4 +176,43 @@ namespace mt
|
||||
return map_id() >= 1002 && map_id() <= 1003;
|
||||
}
|
||||
|
||||
void Map::LoadWorldObjects()
|
||||
{
|
||||
auto parse_func =
|
||||
[] (std::shared_ptr<a8::XObject> node, WorldObject* obj)
|
||||
{
|
||||
obj->object_id = node->At("id")->AsXValue();
|
||||
auto bounds = node->At("bounds");
|
||||
auto center = bounds->At("center");
|
||||
auto size = bounds->At("size");
|
||||
obj->pos.x = center->At("x")->AsXValue().GetDouble();
|
||||
obj->pos.y = center->At("y")->AsXValue().GetDouble();
|
||||
obj->pos.z = center->At("z")->AsXValue().GetDouble();
|
||||
|
||||
obj->size.x = size->At("x")->AsXValue().GetDouble();
|
||||
obj->size.y = size->At("y")->AsXValue().GetDouble();
|
||||
obj->size.z = size->At("z")->AsXValue().GetDouble();
|
||||
};
|
||||
|
||||
a8::XObject root;
|
||||
if (root.ReadFromFile(MetaMgr::Instance()->GetResDir() + world_object_file())) {
|
||||
{
|
||||
auto thing = root.At("thing");
|
||||
for (int i = 0; i < thing->Size(); ++i) {
|
||||
auto& obj = a8::FastAppend(_world_objects);
|
||||
obj.object_type = WorldObjectType_e::kBoxType;
|
||||
parse_func(thing->At(i), &obj);
|
||||
}
|
||||
}
|
||||
{
|
||||
auto thing = root.At("loot");
|
||||
for (int i = 0; i < thing->Size(); ++i) {
|
||||
auto& obj = a8::FastAppend(_world_objects);
|
||||
obj.object_type = WorldObjectType_e::kLootType;
|
||||
parse_func(thing->At(i), &obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace mt
|
||||
int object_id = 0;
|
||||
int object_type = 0;
|
||||
glm::vec3 pos;
|
||||
glm::vec3 size;
|
||||
float rotation = 0.0f;
|
||||
};
|
||||
|
||||
@ -44,6 +45,8 @@ namespace mt
|
||||
void Init1();
|
||||
void Init2();
|
||||
|
||||
private:
|
||||
void LoadWorldObjects();
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user