void draw_intro()
{
- display_text_file("intro.txt", "/images/background/arctis.jpg", SCROLL_SPEED_MESSAGE);
+ display_text_file("intro.txt", SCROLL_SPEED_MESSAGE);
}
#define SCROLL 60
#define ITEMS_SPACE 4
-void display_text_file(const std::string& file, const std::string& surface, float scroll_speed)
-{
- Surface* sur = new Surface(datadir + surface, IGNORE_ALPHA);
- display_text_file(file, sur, scroll_speed);
- delete sur;
-}
-
-void display_text_file(const std::string& file, Surface* surface, float scroll_speed)
+void display_text_file(const std::string& file, float scroll_speed)
{
std::string text;
std::vector<std::string> names;
return;
}
-
reader->read_string("text", text, true);
+ std::string background_file;
+ reader->read_string("background", background_file, true);
delete reader;
+ // Split text string lines into a vector
names.clear();
unsigned int i, l;
i = 0;
i = l+1;
}
+ // load background image
+ Surface* background = new Surface(datadir + "/images/background/" + background_file, IGNORE_ALPHA);
+
int done = 0;
float scroll = 0;
float speed = scroll_speed / 50;
speed = -MAX_VEL;
/* draw the credits */
- context.draw_surface(surface, Vector(0,0), 0);
+ context.draw_surface(background, Vector(0,0), 0);
float y = 0;
for(size_t i = 0; i < names.size(); i++) {
}
SDL_EnableKeyRepeat(0, 0); // disables key repeating
- Menu::set_current(main_menu);
+ delete background;
}
/** Reads a text file (using LispReader, so it as to be in its formatting)
and displays it in a StarTrek fashion */
-void display_text_file(const std::string& file, const std::string& surface, float scroll_speed);
-void display_text_file(const std::string& file, Surface* surface, float scroll_speed);
+void display_text_file(const std::string& file, float scroll_speed);
/* Text type */
class Font
update_time = st_get_ticks();
break;
case MNID_CREDITS:
- display_text_file("CREDITS", bkg_title, SCROLL_SPEED_CREDITS);
+ display_text_file("CREDITS", SCROLL_SPEED_CREDITS);
Menu::set_current(main_menu);
break;
case MNID_QUITMAINMENU:
void
WorldMap::load_map()
{
- std::cout << "Loading map: " << datadir + "/levels/worldmap/" + map_filename << std::endl;
-
lisp_object_t* root_obj = lisp_read_from_file(datadir + "/levels/worldmap/" + map_filename);
if (!root_obj)
st_abort("Couldn't load file", datadir + "/levels/worldmap/" + map_filename);
sound_manager->load_music(datadir + "/music/theme.mod");
sound_manager->play_music(theme);
// Display final credits and go back to the main menu
- display_text_file(level->extro_filename,
- "/images/background/extro.jpg", SCROLL_SPEED_MESSAGE);
- display_text_file("CREDITS",
- "/images/background/oiltux.jpg", SCROLL_SPEED_CREDITS);
+ display_text_file(level->extro_filename, SCROLL_SPEED_MESSAGE);
+ display_text_file("CREDITS", SCROLL_SPEED_CREDITS);
quit = true;
}
}