Code:
void Adt_c::GetDoodads(Meshes_t *meshes) {
for (AdtDoodads_t::iterator doodad = doodads_.begin();
doodad != doodads_.end();
++doodad) {
const MddfChunk_s::DoodadInfo_s &info = *doodad->info;
const M2_c *m2 = doodad->m2;
// add new doodad
meshes->push_back(Mesh_c());
Mesh_c *mesh = &meshes->back();
// if we have a skin we get the real mesh
if(m2->skin.get() != NULL) {
m2->GetMesh(*m2->skin, mesh);
} else {
m2->GetBVMesh(mesh);
}
// don't forget to readjust positions and rotations!
static const float map_center = 17066.0f + (2.0f/3.0f);
mesh->SetPositon(Vec3_t(info.pos.x-map_center, info.pos.y, info.pos.z-map_center));
mesh->SetRotation(Vec3_t(-info.rot.x, info.rot.y-90, info.rot.z-90));
mesh->SetScale(info.scale/1024.0f);
}
}