- for (int y = 0; y < 15; ++y)
- for (int x = 0; x < le_world->get_level()->width; ++x)
- {
-
- Tile::draw_stretched(left_offset + mini_tile_width*x, y * 4, mini_tile_width , 4, le_world->get_level()->bg_tiles[y][x]);
-
- Tile::draw_stretched(left_offset + mini_tile_width*x, y * 4, mini_tile_width , 4, le_world->get_level()->ia_tiles[y][x]);
-
- Tile::draw_stretched(left_offset + mini_tile_width*x, y * 4, mini_tile_width , 4, le_world->get_level()->fg_tiles[y][x]);
-
- }
-
- fillrect(left_offset, 0, le_world->get_level()->width*mini_tile_width, 15*4, 200, 200, 200, 128);
-
- fillrect(left_offset + (pos_x/32)*mini_tile_width, 0, 19*mini_tile_width, 2, 200, 200, 200, 200);
- fillrect(left_offset + (pos_x/32)*mini_tile_width, 0, 2, 15*4, 200, 200, 200, 200);
- fillrect(left_offset + (pos_x/32)*mini_tile_width + 19*mini_tile_width - 2, 0, 2, 15*4, 200, 200, 200, 200);
- fillrect(left_offset + (pos_x/32)*mini_tile_width, 15*4-2, 19*mini_tile_width, 2, 200, 200, 200, 200);
-
-}
-
-void le_drawinterface()
-{
- int x,y;
- char str[80];
-
- if(le_world != NULL)
- {
- /* draw a grid (if selected) */
- if(le_show_grid)
- {
- for(x = 0; x < 19; x++)
- fillrect(x*32 - ((int)pos_x % 32), 0, 1, screen->h, 225, 225, 225,255);
- for(y = 0; y < 15; y++)
- fillrect(0, y*32, screen->w - 32, 1, 225, 225, 225,255);
- }
- }
-
- if(show_minimap) // use_gl because the minimap isn't shown correctly in software mode. Any idea? FIXME Possible reasons: SDL_SoftStretch is a hack itsself || an alpha blitting issue SDL can't handle in software mode
- le_drawminimap();
-
- if(show_selections)
- {
- if(le_selection_mode == CURSOR)
- {
- if(le_current.IsTile())
- le_selection->draw( cursor_x - pos_x, cursor_y);
- }
- else if(le_selection_mode == SQUARE)
- {
- int w, h;
- le_highlight_selection();
- /* draw current selection */
- w = selection.x2 - selection.x1;
- h = selection.y2 - selection.y1;
- fillrect(selection.x1 - pos_x, selection.y1, w, SELECT_W, SELECT_CLR);
- fillrect(selection.x1 - pos_x + w, selection.y1, SELECT_W, h, SELECT_CLR);
- fillrect(selection.x1 - pos_x, selection.y1 + h, w, SELECT_W, SELECT_CLR);
- fillrect(selection.x1 - pos_x, selection.y1, SELECT_W, h, SELECT_CLR);
- }
- }
-
-
- /* draw button bar */
- fillrect(screen->w - 64, 0, 64, screen->h, 50, 50, 50,255);
-
- if(le_current.IsTile())
- {
- Tile::draw(19 * 32, 14 * 32, le_current.tile);
- if(TileManager::instance()->get(le_current.tile)->editor_images.size() > 0)
- TileManager::instance()->get(le_current.tile)->editor_images[0]->draw( 19 * 32, 14 * 32);
- }
- if(le_current.IsObject())
- {
- le_current.obj->draw_on_screen(19 * 32, 14 * 32);
- le_current.obj->draw_on_screen(cursor_x,cursor_y);
- }
-
- if(le_world != NULL)
- {
- le_save_level_bt->draw();
- le_exit_bt->draw();
- le_test_level_bt->draw();
- le_next_level_bt->draw();
- le_previous_level_bt->draw();
- le_rubber_bt->draw();
- if(le_selection_mode == SQUARE)
- le_select_mode_one_bt->draw();
- else if(le_selection_mode == CURSOR)
- le_select_mode_two_bt->draw();
- le_settings_bt->draw();
- le_move_right_bt->draw();
- le_move_left_bt->draw();
- le_tilegroup_bt->draw();
- le_objects_bt->draw();
- if(!cur_tilegroup.empty())
- tilegroups_map[cur_tilegroup]->draw();
- else if(!cur_objects.empty())
- {
- objects_map[cur_objects]->draw();
- }
-
- le_tilemap_panel->draw();
-
- sprintf(str, "%d/%d", le_level,le_level_subset->levels);
- white_text->drawf(str, (le_level_subset->levels < 10) ? -10 : 0, 16, A_RIGHT, A_TOP, 0);
-
- if(!le_help_shown)
- white_small_text->draw("F1 for Help", 10, 430, 1);
- }
- else
- {
- if(!Menu::current())
- white_small_text->draw("No Level Subset loaded - Press ESC and choose one in the menu", 10, 430, 1);
- else
- white_small_text->draw("No Level Subset loaded", 10, 430, 1);
- }
-
-}
-
-void le_drawlevel()
-{
- unsigned int y,x,s;
- Uint8 a;
-
- /* Draw the real background */
- if(le_world->get_level()->bkgd_image[0] != '\0')
- {
- s = (int)((float)pos_x * ((float)le_world->get_level()->bkgd_speed/60.)) % screen->w;
- le_world->get_level()->img_bkgd->draw_part(s,0,0,0,
- le_world->get_level()->img_bkgd->w - s - 32, le_world->get_level()->img_bkgd->h);
- le_world->get_level()->img_bkgd->draw_part(0,0,screen->w - s - 32 ,0,s,
- le_world->get_level()->img_bkgd->h);
- }
- else
- {
- drawgradient(le_world->get_level()->bkgd_top, le_world->get_level()->bkgd_bottom);
- }
-
- if(le_current.IsTile())
- {
- Tile::draw(cursor_x-pos_x, cursor_y,le_current.tile,128);
- if(!TileManager::instance()->get(le_current.tile)->images.empty())
- fillrect(cursor_x-pos_x,cursor_y,TileManager::instance()->get(le_current.tile)->images[0]->w,TileManager::instance()->get(le_current.tile)->images[0]->h,50,50,50,50);
- }
- if(le_current.IsObject())
- {
- le_current.obj->move_to(cursor_x, cursor_y);
- }
-
- /* clearscreen(current_level.bkgd_red, current_level.bkgd_green, current_level.bkgd_blue); */
-
- for (y = 0; y < 15; ++y)
- for (x = 0; x < 20; ++x)
- {
-
- if(active_tm == TM_BG)
- a = 255;
- else
- a = 128;
-
- Tile::draw(32*x - fmodf(pos_x, 32), y * 32, le_world->get_level()->bg_tiles[y][x + (int)(pos_x / 32)],a);
-
- if(active_tm == TM_IA)
- a = 255;
- else
- a = 128;
-
- Tile::draw(32*x - fmodf(pos_x, 32), y * 32, le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)],a);
-
- if(active_tm == TM_FG)
- a = 255;
- else
- a = 128;
-
- Tile::draw(32*x - fmodf(pos_x, 32), y * 32, le_world->get_level()->fg_tiles[y][x + (int)(pos_x / 32)],a);
-
- /* draw whats inside stuff when cursor is selecting those */
- /* (draw them all the time - is this the right behaviour?) */
- Tile* edit_image = TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)]);
- if(edit_image && !edit_image->editor_images.empty())
- edit_image->editor_images[0]->draw( x * 32 - ((int)pos_x % 32), y*32);
-
- }
-
- /* Draw the Bad guys: */
- for (std::list<BadGuy*>::iterator it = le_world->bad_guys.begin(); it != le_world->bad_guys.end(); ++it)
- {
- /* to support frames: img_bsod_left[(frame / 5) % 4] */
-
- scroll_x = pos_x;
- (*it)->draw();
- }
-
-
- /* Draw the player: */
- /* for now, the position is fixed at (100, 240) */
- largetux.walk_right->draw( 100 - pos_x, 240);
-}
-
-void le_change_object_properties(GameObject *pobj)
-{
- Menu* object_properties_menu = new Menu();
-
- object_properties_menu->additem(MN_LABEL,pobj->type() + " Properties",0,0);
- object_properties_menu->additem(MN_HL,"",0,0);
- /*object_properties_menu->additem(MN_TEXTFIELD,"Title",0,0,MNID_SUBSETTITLE);
- object_properties_menu->additem(MN_TEXTFIELD,"Description",0,0,MNID_SUBSETDESCRIPTION);
- object_properties_menu->additem(MN_HL,"",0,0);
- object_properties_menu->additem(MN_ACTION,"Save Changes",0,0,MNID_SUBSETSAVECHANGES);*/
- object_properties_menu->additem(MN_HL,"",0,0);
- object_properties_menu->additem(MN_BACK,"Apply",0,0);
-
- delete object_properties_menu;
-}
-
-
-void le_checkevents()
-{
- SDLKey key;
- SDLMod keymod;
- Button* pbutton;
- int x,y;
-
- keymod = SDL_GetModState();
-
- while(SDL_PollEvent(&event))