le_level_subset.load(level_subsets.item[i-2]);
leveleditor_menu->item[3].kind = MN_GOTO;
le_level = 1;
- world.arrays_free();
+ global_world.arrays_free();
loadshared();
le_current_level = new Level;
if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0)
}
le_set_defaults();
le_current_level->load_gfx();
- world.activate_bad_guys();
+ global_world.activate_bad_guys();
show_menu = true;
}
break;
le_level_subset.load(subset_new_menu->item[2].input);
leveleditor_menu->item[3].kind = MN_GOTO;
le_level = 1;
- world.arrays_free();
+ global_world.arrays_free();
loadshared();
le_current_level = new Level;
if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0)
}
le_set_defaults();
le_current_level->load_gfx();
- world.activate_bad_guys();
+ global_world.activate_bad_guys();
menu_item_change_input(&subset_new_menu->item[2],"");
show_menu = true;
break;
void le_goto_level(int levelnb)
{
- world.arrays_free();
+ global_world.arrays_free();
le_current_level->cleanup();
if(le_current_level->load(le_level_subset.name.c_str(), levelnb) != 0)
le_current_level->free_gfx();
le_current_level->load_gfx();
- world.activate_bad_guys();
+ global_world.activate_bad_guys();
}
void le_quit(void)
{
le_current_level->free_gfx();
le_current_level->cleanup();
- world.arrays_free();
+ global_world.arrays_free();
unloadshared();
}
}
}
/* Draw the Bad guys: */
- for (i = 0; i < world.bad_guys.size(); ++i)
+ for (i = 0; i < global_world.bad_guys.size(); ++i)
{
/* to support frames: img_bsod_left[(frame / 5) % 4] */
scroll_x = pos_x;
- world.bad_guys[i].draw();
+ global_world.bad_guys[i].draw();
}
xx = ((int)x / 32);
/* if there is a bad guy over there, remove it */
- for(i = 0; i < world.bad_guys.size(); ++i)
- if(xx == world.bad_guys[i].base.x/32 && yy == world.bad_guys[i].base.y/32)
- world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&world.bad_guys[i]));
+ for(i = 0; i < global_world.bad_guys.size(); ++i)
+ if(xx == global_world.bad_guys[i].base.x/32 && yy == global_world.bad_guys[i].base.y/32)
+ global_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&global_world.bad_guys[i]));
if(c == '0') /* if it's a bad guy */
- world.add_bad_guy(xx*32, yy*32, BAD_BSOD);
+ global_world.add_bad_guy(xx*32, yy*32, BAD_BSOD);
else if(c == '1')
- world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP);
+ global_world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP);
else if(c == '2')
- world.add_bad_guy(xx*32, yy*32, BAD_MONEY);
+ global_world.add_bad_guy(xx*32, yy*32, BAD_MONEY);
break;
case SQUARE:
y2 /= 32;
/* if there is a bad guy over there, remove it */
- for(i = 0; i < world.bad_guys.size(); ++i)
- if(world.bad_guys[i].base.x/32 >= x1 && world.bad_guys[i].base.x/32 <= x2
- && world.bad_guys[i].base.y/32 >= y1 && world.bad_guys[i].base.y/32 <= y2)
- world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&world.bad_guys[i]));
+ for(i = 0; i < global_world.bad_guys.size(); ++i)
+ if(global_world.bad_guys[i].base.x/32 >= x1 && global_world.bad_guys[i].base.x/32 <= x2
+ && global_world.bad_guys[i].base.y/32 >= y1 && global_world.bad_guys[i].base.y/32 <= y2)
+ global_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&global_world.bad_guys[i]));
for(xx = x1; xx <= x2; xx++)
for(yy = y1; yy <= y2; yy++)
le_current_level->change(xx*32, yy*32, tm, c);
if(c == '0') // if it's a bad guy
- world.add_bad_guy(xx*32, yy*32, BAD_BSOD);
+ global_world.add_bad_guy(xx*32, yy*32, BAD_BSOD);
else if(c == '1')
- world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP);
+ global_world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP);
else if(c == '2')
- world.add_bad_guy(xx*32, yy*32, BAD_MONEY);
+ global_world.add_bad_guy(xx*32, yy*32, BAD_MONEY);
}
break;
default:
session.run();
Menu::set_current(leveleditor_menu);
- world.arrays_free();
+ global_world.arrays_free();
le_current_level->load_gfx();
loadshared();
- world.activate_bad_guys();
+ global_world.activate_bad_guys();
}
void le_showhelp()
issolid(pbullet->base.x + 4, pbullet->base.y + 2) ||
issolid(pbullet->base.x, pbullet->base.y + 2))
{
- world.bullets.erase(static_cast<std::vector<bullet_type>::iterator>(pbullet));
+ World::current()->bullets.erase(static_cast<std::vector<bullet_type>::iterator>(pbullet));
}
}
if(c_object == CO_BADGUY) {
std::vector<bullet_type>::iterator i;
- for(i = world.bullets.begin(); i != world.bullets.end(); ++i) {
+ for(i = World::current()->bullets.begin(); i != World::current()->bullets.end(); ++i) {
if(& (*i) == pbullet) {
- world.bullets.erase(i);
+ World::current()->bullets.erase(i);
return;
}
}
/* Off the screen? Kill it! */
if (pupgrade->base.x < scroll_x - pupgrade->base.width)
- world.upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
+ World::current()->upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
if (pupgrade->base.y > screen->h)
- world.upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
+ World::current()->upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
if (issolid(pupgrade->base.x + 1, pupgrade->base.y + 32.) ||
issolid(pupgrade->base.x + 31., pupgrade->base.y + 32.))
/* p_c_object is CO_PLAYER, so assign it to pplayer */
pplayer = (Player*) p_c_object;
- world.upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
+ World::current()->upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
/* Affect the player: */