bool PhysicalObj::PutOutOfGround() { if (IsOutsideWorld(Point2i(0, 0))) return false; if (IsInVacuum(Point2i(0, 0))) return true; bool left,right,top,bottom; left = GetWorld().IsInVacuum_left(*this, 0, 0); right = GetWorld().IsInVacuum_right(*this, 0, 0); top = GetWorld().IsInVacuum_top(*this, 0, 0); bottom = GetWorld().IsInVacuum_bottom(*this, 0, 0); int dx = (int)GetTestRect().GetSizeX() * (right-left); int dy = (int)GetTestRect().GetSizeY() * (top-bottom); if (!dx && !dy) return false; //->Don't know in which direction we should go... Point2i b(dx, dy); Double dir = b.ComputeAngle(); return PutOutOfGround(dir); }
void PolecatFart::Refresh() { Particle::Refresh(); FOR_ALL_LIVING_CHARACTERS(team, c) { if ((c->GetTestRect()).Intersect(GetTestRect())) { //c->SetEnergyDelta(-10); c->SetDiseaseDamage(&ActiveCharacter(), 5, std::numeric_limits<uint>::max()); is_active = false; } } }
void PhysicalObj::CheckOverlapping() { if (!m_overlapping_object) return; // Check if we are still overlapping with this object if (!m_overlapping_object->GetTestRect().Intersect(GetTestRect()) && m_minimum_overlapse_time <= GameTime::GetInstance()->Read()) { MSG_DEBUG("physic.overlapping", "\"%s\" just stopped overlapping with \"%s\" (%d ms left)", GetName().c_str(), m_overlapping_object->GetName().c_str(), (m_minimum_overlapse_time - GameTime::GetInstance()->Read())); SetOverlappingObject(NULL); } else { MSG_DEBUG("physic.overlapping", "\"%s\" is overlapping with \"%s\"", GetName().c_str(), m_overlapping_object->GetName().c_str()); } }