- 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 && MouseCursor::current() != mouse_select_object)
- {
- if(le_selection_mode == CURSOR)
- {
- if(le_current.IsTile())
- le_selection->draw(cursor_x - pos_x, cursor_y - pos_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 - pos_y, w, SELECT_W, SELECT_CLR);
- fillrect(selection.x1 - pos_x + w, selection.y1 - pos_y, SELECT_W, h, SELECT_CLR);
- fillrect(selection.x1 - pos_x, selection.y1 - pos_y + h, w, SELECT_W, SELECT_CLR);
- fillrect(selection.x1 - pos_x, selection.y1 - pos_y, 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(screen->w - 32, screen->h - 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( screen->w - 32, screen->h - 32);
- }
-#if 0 // XXX FIXME TODO
- if(le_current.IsObject() && MouseCursor::current() != mouse_select_object)
- {
- le_current.obj->draw_on_screen(screen->w - 32, screen->h - 32);
- le_current.obj->draw_on_screen(cursor_x,cursor_y);
- }
-#endif
-
- if(mouse_select_object && selected_game_object != NULL)
- {
- fillrect(selected_game_object->base.x-pos_x,selected_game_object->base.y-pos_y,selected_game_object->base.width,3,255,0,0,255);
- fillrect(selected_game_object->base.x-pos_x,selected_game_object->base.y-pos_y,3,selected_game_object->base.height,255,0,0,255);
- fillrect(selected_game_object->base.x-pos_x,selected_game_object->base.y-pos_y+selected_game_object->base.height,selected_game_object->base.width,3,255,0,0,255);
- fillrect(selected_game_object->base.x-pos_x+selected_game_object->base.width,selected_game_object->base.y-pos_y,3,selected_game_object->base.height,255,0,0,255);
- }
-
- 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_move_up_bt->draw();
- le_move_down_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();
-
- if(!cur_objects.empty())
- {
- le_object_select_bt->draw();
- le_object_properties_bt->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);
-
- if(display_level_info.check())
- white_text->drawf(le_world->get_level()->name.c_str(), 0, 0, A_HMIDDLE, A_TOP, 0);
- }
- 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;
- Uint8 a;
-
- /* Draw the real background */
- le_world->background->draw(le_world->displaymanager.get_viewport(),
- LAYER_BACKGROUND0);
-
- if(le_current.IsTile())
- {
- Tile::draw(cursor_x-pos_x, cursor_y-pos_y,le_current.tile,128);
- if(!TileManager::instance()->get(le_current.tile)->images.empty())
- fillrect(cursor_x-pos_x,cursor_y-pos_y,TileManager::instance()->get(le_current.tile)->images[0]->w,TileManager::instance()->get(le_current.tile)->images[0]->h,50,50,50,50);
- }
-#if 0 // XXX FIXME TODO
- if(le_current.IsObject())
- {
- le_current.obj->move_to(cursor_x, cursor_y);
- }
-#endif
-
- /* clearscreen(current_level.bkgd_red, current_level.bkgd_green, current_level.bkgd_blue); */
-
- Level* level = le_world->get_level();
- for (y = 0; y < VISIBLE_TILES_Y && y < (unsigned)le_world->get_level()->height; ++y)
- for (x = 0; x < (unsigned)VISIBLE_TILES_X - 2; ++x)
- {
-
- if(active_tm == TM_BG)
- a = 255;
- else
- a = 128;
-
- Tile::draw(32*x - fmodf(pos_x, 32), y*32 - fmodf(pos_y, 32),
- level->bg_tiles[ (y + (int)(pos_y / 32)) * level->width +
- (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 - fmodf(pos_y, 32),
- level->ia_tiles[ (y + (int)(pos_y / 32)) * level->width +
- (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 - fmodf(pos_y, 32),
- level->fg_tiles[ (y + (int)(pos_y / 32)) * level->width +
- (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(
- level->ia_tiles
- [ (y + (int)(pos_y / 32)) * level->width + (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 - ((int)pos_y % 32));
-
- }
-
- /* Draw the Bad guys: */
- for (std::vector<GameObject*>::iterator it = le_world->gameobjects.begin();
- it != le_world->gameobjects.end(); ++it)
- {
- BadGuy* badguy = dynamic_cast<BadGuy*> (*it);
- if(badguy == 0)
- continue;
-
- /* to support frames: img_bsod_left[(frame / 5) % 4] */
- ViewPort viewport;
- viewport.set_translation(Vector(pos_x, pos_y));
- badguy->draw(viewport, 0);
- }
-
- /* Draw the player: */
- /* for now, the position is fixed at (100, 240) */
- largetux.walk_right->draw( 100 - pos_x, 240 - pos_y);