This commit is contained in:
aozhiwei 2023-01-06 13:32:20 +08:00
parent 82ba602486
commit 41c36099de
4 changed files with 17 additions and 9 deletions

View File

@ -611,15 +611,15 @@ void MapInstance::MarkMapAreaPolys()
}
for (int i = 0; i < tile->header->polyCount; ++i) {
dtPoly* poly = &tile->polys[i];
const mt::MapArea* last_area_meta = nullptr;
if ((poly->flags & SAMPLE_POLYFLAGS_SWIM) == SAMPLE_POLYFLAGS_SWIM) {
const mt::MapArea* last_area_meta = nullptr;
for (int ii = 0; ii < poly->vertCount; ++ii) {
const float* vc = &tile->verts[poly->verts[ii]*3];
const mt::MapArea* area_meta = mt::MapArea::GetAreaByPoint
(map_meta_->map_id(),
vc[0] * GetMapMeta()->scale(),
vc[0] / GetMapMeta()->scale(),
vc[1],
vc[2] * GetMapMeta()->scale());
vc[2] / GetMapMeta()->scale());
if (!area_meta) {
abort();
}
@ -628,6 +628,9 @@ void MapInstance::MarkMapAreaPolys()
}
last_area_meta = area_meta;
}
if (!last_area_meta) {
abort();
}
}
}
}

View File

@ -16,6 +16,9 @@ void MapMgr::Init()
(
[this] (const mt::Map* map_meta, bool& stop)
{
if (map_meta->map_id() != 2001) {
return;
}
auto map_instance = std::make_shared<MapInstance>();
map_instance->map_id = map_meta->map_id();
map_instance->Init();

View File

@ -220,6 +220,7 @@ anim.l_y = l_y;
((mt::Hero*)hero_meta)->shot_animations[id] = anim;
}
}
#if 0
f8::UdpLog::Instance()->Info
("shot animation hero_id:%d anim_id:%d t:%f r_x:%f r_y:%f r_z:%f l_x:%f l_y:%f l_z:%f",
{
@ -233,6 +234,7 @@ anim.l_y = l_y;
l_y,
l_z
});
#endif
}
}
}

View File

@ -31,16 +31,16 @@ namespace mt
if (itr != map_areas.end()) {
for (auto area_meta : itr->second) {
if (x < area_meta->center_.x - area_meta->area_width() / 2) {
break;
continue;
}
if (x > area_meta->center_.x + area_meta->area_width() / 2) {
break;
continue;
}
if (y < area_meta->center_.y - area_meta->area_height() / 2) {
break;
if (z < area_meta->center_.y - area_meta->area_height() / 2) {
continue;
}
if (y > area_meta->center_.y + area_meta->area_height() / 2) {
break;
if (z > area_meta->center_.y + area_meta->area_height() / 2) {
continue;
}
return area_meta;
}