switch (leveleditor_menu->check())
{
case MNID_RETURNLEVELEDITOR:
+ if(le_world != NULL)
Menu::set_current(0);
+ else
+ Menu::set_current(leveleditor_menu);
break;
case MNID_SUBSETSETTINGS:
update_subset_settings_menu();
break;
default:
- //show_menu = true;
break;
}
}
default:
if(it >= 0)
{
- cur_tilegroup
- = select_tilegroup_menu->get_item_by_id(it).text;
+ cur_tilegroup = select_tilegroup_menu->get_item_by_id(it).text;
Menu::set_current(0);
cur_objects = "";
select_tilegroup_menu->arrange_left = true;
select_tilegroup_menu->additem(MN_LABEL,"Tilegroup",0,0);
select_tilegroup_menu->additem(MN_HL,"",0,0);
+ select_tilegroup_menu->additem(MN_ACTION,"asd",0,0);
std::set<TileGroup>* tilegroups = TileManager::tilegroups();
int tileid = 1;
for(std::set<TileGroup>::iterator it = tilegroups->begin();
le_world->get_level()->song_title = string_list_active(level_settings_menu->get_item_by_id(MNID_SONG).list);
le_world->get_level()->change_size(atoi(level_settings_menu->get_item_by_id(MNID_LENGTH).input));
- le_world->get_level()->time_left = atoi(level_settings_menu->get_item_by_id(MNID_BGIMG).input);
+ le_world->get_level()->time_left = atoi(level_settings_menu->get_item_by_id(MNID_TIME).input);
le_world->get_level()->gravity = atof(level_settings_menu->get_item_by_id(MNID_GRAVITY).input);
le_world->get_level()->bkgd_speed = atoi(level_settings_menu->get_item_by_id(MNID_BGSPEED).input);
le_world->get_level()->bkgd_top.red = atoi(level_settings_menu->get_item_by_id(MNID_TopRed).input);
/* draw whats inside stuff when cursor is selecting those */
/* (draw them all the time - is this the right behaviour?) */
- if(TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)])->editor_images.size() > 0)
+ if(!TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)])->editor_images.empty())
TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)])->editor_images[0]->draw( x * 32 - ((int)pos_x % 32), y*32);
}
fire =UP;
break;
case SDLK_F1:
+ if(le_world != NULL)
le_showhelp();
break;
case SDLK_HOME:
{
Menu::set_current(0);
}
+ le_objects_bt->event(event);
+ if(le_objects_bt->get_state() == BUTTON_CLICKED)
+ {
+ Menu::set_current(0);
+ }
}
}
{
int xx,yy;
int x1, x2, y1, y2;
- unsigned int i;
+ unsigned int i = 0;
/* level_changed = true; */
cursor_base.height = 32;
/* if there is a bad guy over there, remove it */
- for(std::list<BadGuy*>::iterator it = le_world->bad_guys.begin(); it != le_world->bad_guys.end(); ++it)
+ for(std::list<BadGuy*>::iterator it = le_world->bad_guys.begin(); it != le_world->bad_guys.end(); ++it, ++i)
if(rectcollision(cursor_base,(*it)->base))
{
- le_world->bad_guys.erase(le_world->bad_guys.begin(),it);
+ delete (*it);
+ le_world->bad_guys.erase(it);
le_world->get_level()->badguy_data.erase(le_world->get_level()->badguy_data.begin() + i);
+ break;
}
break;
if((*it)->base.x/32 >= x1 && (*it)->base.x/32 <= x2
&& (*it)->base.y/32 >= y1 && (*it)->base.y/32 <= y2)
{
+ delete (*it);
it = le_world->bad_guys.erase(it);
+ le_world->get_level()->badguy_data.erase(le_world->get_level()->badguy_data.begin() + i);
continue;
}
else
{
+ ++i;
++it;
}
}
void le_testlevel()
{
+ //Make sure a time value is set when testing the level
+ if(le_world->get_level()->time_left == 0)
+ le_world->get_level()->time_left = 250;
+
le_world->get_level()->save("test", le_level);
GameSession session("test",le_level, ST_GL_TEST);
music_manager->halt_music();
Menu::set_current(NULL);
- /*delete le_world.arrays_free();
- le_current_level->load_gfx();
- le_world.activate_bad_guys();*/
+ World::set_current(le_world);
}
void le_showhelp()
SDL_Event event;
unsigned int i, done_;
char *text[] = {
- " - This is SuperTux's built-in level editor -",
- "It has been designed to be light and easy to use from the start.",
- "",
- "When you first load the level editor you are given a menu where you",
- "can load level subsets, create a new level subset, edit the current",
- "subset's settings, or simply quit the editor. You can access this menu",
- "from the level editor at any time by pressing the escape key.",
- "",
- "To your right is your button bar. The center of this contains many",
- "tiles you can use to make your level. To select a tile, click on it",
- "with your left mouse button; your selection will be shown in the",
- "bottom right corner of the button box. Click anywhere on your level",
- "with the left mouse button to place that tile down. If you right click",
- "a tile in the button bar, you can find out what its keyboard shortcut",
- "is. The three buttons FGD, BGD and EMY let you pick from foreground,",
- "background, and enemy tiles. The eraser lets you remove tiles.",
- "The left and right arrow keys scroll back and forth through your level.",
- "The button with the wrench and screwdriver, lets you change the",
- "settings of your level, including how long it is or what music it will",
- "play. When you are ready to give your level a test, click on the little",
- "running Tux. If you like the changes you have made to your level,",
- "press the red save key to keep them.",
- "To change which level in your subset you are editing, press the white",
- "up and down arrow keys at the top of the button box.",
- "",
+
+ " - Supertux level editor tutorial - ",
+ "",
+ "To make your map, click the tilegroup button and choose a tilegroup."
+ "Pick a tile and simply hold down the left mouse button over the map",
+ "to \"paint\" your selection over the screen.",
+ "There are three layers for painting tiles upon, Background layer,",
+ "the Interactive layer, and the Foreground layer, which can be toggled",
+ "by the BkGrd, IntAct and FrGrd buttons. The Foreground and Background",
+ "layers do not effect Tux in the gameplay, but lie in front of him or",
+ "lie behind him in his adventures. The tiles placed on the Interactive",
+ "layer are those which actually effect Tux in the game.",
+ "Click the objects menu to put bad guys and other objects in the game.",
+ "Unlike placing tiles, you cannot \"paint\" enemies. Click them onto",
+ "the screen one at a time.",
+ "To change the settings of your level, click the button with the",
+ "screwdriver and wrench. From here you can change the background,",
+ "music, length of the level, and more.",
+ "You may have more than one levelset. Pressing the up and down buttons",
+ "above the button bar lets you choose which one you are working on.",
+ "If you would like to speed up your level editing, a useful trick is",
+ "to learn the keyboard shortcuts. They are easy to learn, just right-",
"Have fun making levels! If you make some good ones, send them to us on",
"the SuperTux mailing list!",
"- SuperTux team"
};
+ char *text2[] = {
+
+ " - Supertux level editor tutorial - ",
+ "",
+ "To make your map, click the tilegroup button and choose a tilegroup."
+ "APick a tile and simply hold down the left mouse button over the map",
+ "Ato \"paint\" your selection over the screen.",
+ "AThere are three layers for painting tiles upon, Background layer,",
+ "the Interactive layer, and the Foreground layer, which can be toggled",
+ "by the BkGrd, IntAct and FrGrd buttons. The Foreground and Background",
+ "layers do not effect Tux in the gameplay, but lie in front of him or",
+ "lie behind him in his adventures. The tiles placed on the Interactive",
+ "layer are those which actually effect Tux in the game.",
+ "Click the objects menu to put bad guys and other objects in the game.",
+ "Unlike placing tiles, you cannot \"paint\" enemies. Click them onto",
+ "the screen one at a time.",
+ "To change the settings of your level, click the button with the",
+ "screwdriver and wrench. From here you can change the background,",
+ "music, length of the level, and more.",
+ "You may have more than one levelset. Pressing the up and down buttons",
+ "above the button bar lets you choose which one you are working on.",
+ "If you would like to speed up your level editing, a useful trick is",
+ "to learn the keyboard shortcuts. They are easy to learn, just right-",
+ "Have fun making levels! If you make some good ones, send them to us on",
+ "the SuperTux mailing list!",
+ "- SuperTux team"
+ };
+
blue_text->drawf("- Help -", 0, 30, A_HMIDDLE, A_TOP, 2);
for(i = 0; i < sizeof(text)/sizeof(char *); i++)
- white_small_text->draw(text[i], 5, 80+(i*white_small_text->h), 1);
+ white_text->draw(text[i], 5, 80+(i*white_text->h), 1);
+
+ gold_text->drawf("Press Any Key to Continue - Page 1/2", 0, 440, A_HMIDDLE, A_TOP, 1);
+
+ flipscreen();
+
+ done_ = 0;
+
+ while(done_ == 0)
+ {
+ done_ = wait_for_event(event);
+ SDL_Delay(50);
+ }
+
+ le_drawlevel();
+ le_drawinterface();
+
+ blue_text->drawf("- Help -", 0, 30, A_HMIDDLE, A_TOP, 2);
+
+ for(i = 0; i < sizeof(text2)/sizeof(char *); i++)
+ white_text->draw(text2[i], 5, 80+(i*white_text->h), 1);
- gold_text->drawf("Press Any Key to Continue", 0, 440, A_HMIDDLE, A_TOP, 1);
+ gold_text->drawf("Press Any Key to Continue - Page 2/2", 0, 440, A_HMIDDLE, A_TOP, 1);
flipscreen();