1
This commit is contained in:
parent
1b8b0852ee
commit
24b1944909
@ -19,6 +19,7 @@ void DummyEntity::Initialize()
|
||||
collider->owner = this;
|
||||
collider->pos = a8::Vec2(obj.x(), obj.y());
|
||||
collider->rad = obj.rad();
|
||||
collider->tag = obj.collider_tag();
|
||||
if (obj.bullet_penetrate()) {
|
||||
a8::SetBitFlag(collider->tag, kHalfWallTag);
|
||||
}
|
||||
@ -34,6 +35,7 @@ void DummyEntity::Initialize()
|
||||
obj.y() - obj.height()/2.0);
|
||||
collider->_max = a8::Vec2(obj.x() + obj.width()/2.0,
|
||||
obj.y() + obj.height()/2.0);
|
||||
collider->tag = obj.collider_tag();
|
||||
if (obj.bullet_penetrate()) {
|
||||
a8::SetBitFlag(collider->tag, kHalfWallTag);
|
||||
}
|
||||
|
@ -259,6 +259,17 @@ void MapInstance::CreateTerrain()
|
||||
assert(collider_tag > 0);
|
||||
}
|
||||
if (collider_tag != 0) {
|
||||
#if 1
|
||||
auto& block = a8::FastAppend(terrain_blocks_);
|
||||
block.set_shape(2);
|
||||
block.set_x(x);
|
||||
block.set_y(y);
|
||||
block.set_height(thing_meta->i->height());
|
||||
block.set_width(thing_meta->i->width());
|
||||
block.set_rad(std::max(thing_meta->i->height(), thing_meta->i->width()));
|
||||
block.set_bullet_penetrate(0);
|
||||
block.set_collider_tag(collider_tag);
|
||||
#else
|
||||
assert(w < 300 && h < 300);
|
||||
assert(collider_tag > 0);
|
||||
InternalCreateObstacle(thing_meta->i->thing_id(), x, y, collider_tag,
|
||||
@ -268,11 +279,21 @@ void MapInstance::CreateTerrain()
|
||||
true,
|
||||
w,
|
||||
h);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
DummyEntity* dummy = EntityFactory::Instance()->MakeDummy(AllocUniid());
|
||||
dummy->SetPos(a8::Vec2());
|
||||
dummy->permanent_map_service = map_service_;
|
||||
dummy->blocks = &terrain_blocks_;
|
||||
dummy->Initialize();
|
||||
uniid_hash_[dummy->GetUniId()] = dummy;
|
||||
grid_service_->AddPermanentEntity(dummy);
|
||||
}
|
||||
}
|
||||
|
||||
void MapInstance::CreateBlock()
|
||||
|
@ -62,6 +62,7 @@ class MapInstance
|
||||
std::vector<MetaData::MapTplThing*> loots_;
|
||||
std::vector<Building*> buildings_;
|
||||
std::vector<MetaData::MapTplThing*> level0room_spec_things_;
|
||||
std::list<metatable::MapBlockJson> terrain_blocks_;
|
||||
|
||||
int building_num_ = 0;
|
||||
int obstacle_num_ = 0;
|
||||
|
@ -462,4 +462,5 @@ message MapBlockJson
|
||||
optional float width = 8;
|
||||
optional float rad = 9;
|
||||
optional int32 bullet_penetrate = 10;
|
||||
optional int32 collider_tag = 11;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user