static bool IsObjectInField(PHYSICS_BOX_DATA * pbox) { for(size_t i = 0; i < MAX_SPELLS; i++) { const SpellBase * spell = spells[SpellHandle(i)]; if(spell && spell->m_type == SPELL_CREATE_FIELD) { const CreateFieldSpell * sp = static_cast<const CreateFieldSpell *>(spell); if(ValidIONum(sp->m_entity)) { Entity * pfrm = entities[sp->m_entity]; Cylinder cyl = Cylinder(Vec3f_ZERO, 35.f, -35.f); for(long k = 0; k < pbox->nb_physvert; k++) { PHYSVERT * pv = &pbox->vert[k]; cyl.origin = pv->pos + Vec3f(0.f, 17.5f, 0.f); if(CylinderPlatformCollide(cyl, pfrm)) { return true; } } } } } return false; }
static bool IsPointInField(const Vec3f & pos) { for(size_t i = 0; i < MAX_SPELLS; i++) { const SpellBase * spell = spells[SpellHandle(i)]; if(spell && spell->m_type == SPELL_CREATE_FIELD) { const CreateFieldSpell * sp = static_cast<const CreateFieldSpell *>(spell); if(ValidIONum(sp->m_entity)) { Entity * pfrm = entities[sp->m_entity]; Cylinder cyl; cyl.height = -35.f; cyl.radius = 35.f; cyl.origin = pos + Vec3f(0.f, 17.5f, 0.f); if(CylinderPlatformCollide(cyl, pfrm) != 0.f) { return true; } } } } return false; }