bool Sector::show_collrects = false;
bool Sector::draw_solids_only = false;
-Sector::Sector()
- : currentmusic(LEVEL_MUSIC), gravity(10),
+Sector::Sector(Level* parent)
+ : level(parent), currentmusic(LEVEL_MUSIC), gravity(10),
player(0), solids(0), camera(0)
{
add_object(new Player(player_status));
delete *i;
}
+Level*
+Sector::get_level()
+{
+ return level;
+}
+
GameObject*
Sector::parse_object(const std::string& name, const lisp::Lisp& reader)
{
Sector::add_bullet(const Vector& pos, float xm, Direction dir)
{
// TODO remove this function and move these checks elsewhere...
- static const size_t MAX_FIRE_BULLETS = 2;
- static const size_t MAX_ICE_BULLETS = 1;
Bullet* new_bullet = 0;
if(player_status->bonus == FIRE_BONUS) {
- if(bullets.size() > MAX_FIRE_BULLETS-1)
+ if((int)bullets.size() >= player_status->max_fire_bullets)
return false;
new_bullet = new Bullet(pos, xm, dir, FIRE_BULLET);
} else if(player_status->bonus == ICE_BONUS) {
- if(bullets.size() > MAX_ICE_BULLETS-1)
+ if((int)bullets.size() >= player_status->max_ice_bullets)
return false;
new_bullet = new Bullet(pos, xm, dir, ICE_BULLET);
} else {
{
if(rect.p1.x > solids->get_width() * 32
|| rect.p1.y > solids->get_height() * 32
- || rect.p2.x < 0 || rect.p2.y < 0)
+ || rect.p2.x < 0)
return false;
return true;