Fix obj_extractor: angle, scale, Towers.

This commit is contained in:
lzwdgc 2015-08-01 00:59:06 +03:00
parent 25956640c9
commit 93850b0864
3 changed files with 18 additions and 22 deletions

View file

@ -129,7 +129,8 @@ void write_mmo(string db, const storage &s)
for (auto &seg : s.objects.segments)
{
if (seg->segment_type == SegmentType::SHELL)
if (seg->segment_type == SegmentType::SHELL ||
seg->segment_type == SegmentType::TOWER)
{
SegmentObjects<Shell> *segment = (SegmentObjects<Shell> *)seg;
set<string> objs;
@ -160,13 +161,11 @@ void write_mmo(string db, const storage &s)
mb.x = object.position.x;
mb.y = object.position.y;
mb.z = object.position.z;
mb.roll = atan2(object.m_rotate_z[2].y, object.m_rotate_z[2].z);
mb.pitch = atan2(-object.m_rotate_z[2].x, sqrt(object.m_rotate_z[2].y * object.m_rotate_z[2].y + object.m_rotate_z[2].z * object.m_rotate_z[2].z));
mb.yaw = atan2(object.m_rotate_z[1].x, object.m_rotate_z[0].x);
// to grad
RAD2GRAD(mb.roll);
RAD2GRAD(mb.pitch);
mb.roll = 0;
mb.pitch = 0;
mb.yaw = acos(object.m_rotate_z[0].x);
RAD2GRAD(mb.yaw);
mb.scale = object.m_rotate_z[2].z;
auto i = find_if(storage->mapBuildings.begin(), storage->mapBuildings.end(), [&](const decltype(Storage::mapBuildings)::value_type &p)
{
return *p.second.get() == mb;
@ -212,13 +211,11 @@ void write_mmo(string db, const storage &s)
mb.x = object.position.x;
mb.y = object.position.y;
mb.z = object.position.z;
mb.roll = atan2(object.m_rotate_z[2].y, object.m_rotate_z[2].z);
mb.pitch = atan2(-object.m_rotate_z[2].x, sqrt(object.m_rotate_z[2].y * object.m_rotate_z[2].y + object.m_rotate_z[2].z * object.m_rotate_z[2].z));
mb.yaw = atan2(object.m_rotate_z[1].x, object.m_rotate_z[0].x);
// to grad
RAD2GRAD(mb.roll);
RAD2GRAD(mb.pitch);
mb.roll = 0;
mb.pitch = 0;
mb.yaw = acos(object.m_rotate_z[0].x);
RAD2GRAD(mb.yaw);
mb.scale = object.m_rotate_z[2].z;
auto i = find_if(storage->mapObjects.begin(), storage->mapObjects.end(), [&](const decltype(Storage::mapObjects)::value_type &p)
{
return *p.second.get() == mb;

View file

@ -53,9 +53,6 @@ Segment *Segment::create_segment(buffer &b)
case SegmentType::SOUND:
segment = new SegmentObjects<Sound>;
break;
case SegmentType::MUSIC:
segment = new SegmentObjects<Music>;
break;
case SegmentType::ANOMALY:
segment = new SegmentObjects<Anomaly>;
break;
@ -68,6 +65,9 @@ Segment *Segment::create_segment(buffer &b)
case SegmentType::GOODS:
segment = new SegmentObjects<Goods>;
break;
case SegmentType::SOUND_ZONE:
segment = new SegmentObjects<SoundZone>;
break;
case SegmentType::unk1:
segment = new SegmentObjects<unk1>;
break;

View file

@ -52,9 +52,8 @@ enum class SegmentType : uint32_t
LAMP,
COVERING,
SOUND,
MUSIC,
GOODS,
ANOMALY,
TOWER,
BOUNDARY,
@ -155,7 +154,7 @@ struct Sound : public Common
};
struct Road : public MapObjectWithArray {};
struct Tower : public MapObjectWithArray {};
struct Boundary : public MapObjectWithArray {};
#define KNOWN_OBJECT(name) \
struct name : public MapObject {}
@ -166,15 +165,15 @@ KNOWN_OBJECT(Shell);
KNOWN_OBJECT(Stone);
KNOWN_OBJECT(Explosion);
KNOWN_OBJECT(Image);
KNOWN_OBJECT(Music);
KNOWN_OBJECT(Goods);
KNOWN_OBJECT(Anomaly);
KNOWN_OBJECT(Boundary);
KNOWN_OBJECT(Tower);
KNOWN_OBJECT(SoundZone);
#define UNKNOWN_OBJECT(name) \
struct name : public MapObject { void load(buffer &b){ int pos = b.index(); assert(false); } }
UNKNOWN_OBJECT(Building);
UNKNOWN_OBJECT(Goods);
UNKNOWN_OBJECT(unk1);
struct Objects