0x080826f5 in display_text_file(std::string const&, Surface*) () at music_manager.cpp:26
26 MusicManager::MusicManager()
(gdb) where
#0 0x080826f5 in display_text_file(std::string const&, Surface*) () at music_manager.cpp:26
#1 0x080826b5 in display_text_file(std::string const&, std::string const&) (file=@0x88ad5d0, surface=@0xbffff230)
at text.cpp:234
#2 0x08093b31 in WorldMapNS::WorldMap::update() (this=0xbffff3b0) at worldmap.cpp:685
SVN-Revision: 782
Player* tux = world->get_tux();
/* End of level? */
- int endpos = (World::current()->get_level()->width-10) * 32;
+ int endpos = (World::current()->get_level()->width-5) * 32;
Tile* endtile = collision_goal(tux->base);
- //printf("EndTile: %p.\n", endtile);
+
// fallback in case the other endpositions don't trigger
if (tux->base.x >= endpos || (endtile && endtile->data >= 1)
|| (end_sequence && !endsequence_timer.check()))
int
Level::load(const std::string& filename)
{
- FILE * fi;
- lisp_object_t* root_obj = 0;
- fi = fopen(filename.c_str(), "r");
- if (fi == NULL)
+ lisp_object_t* root_obj = lisp_read_from_file(filename);
+ if (!root_obj)
{
- perror(filename.c_str());
+ std::cout << "Level: Couldn't load file: " << filename << std::endl;
return -1;
}
- lisp_stream_t stream;
- lisp_stream_init_file (&stream, fi);
- root_obj = lisp_read (&stream);
-
if (root_obj->type == LISP_TYPE_EOF || root_obj->type == LISP_TYPE_PARSE_ERROR)
{
printf("World: Parse Error in file %s", filename.c_str());
+ return -1;
}
vector<int> ia_tm;
}
lisp_free(root_obj);
- fclose(fi);
return 0;
}
#define SCROLL 60
#define ITEMS_SPACE 4
-void display_text_file(char *file, char* surface)
+void display_text_file(const std::string& file, const std::string& surface)
{
-Surface* sur = new Surface(datadir + surface, IGNORE_ALPHA);
-display_text_file(file, sur);
-delete sur;
+ Surface* sur = new Surface(datadir + surface, IGNORE_ALPHA);
+ display_text_file(file, sur);
+ delete sur;
}
-void display_text_file(char *file, Surface* surface)
+void display_text_file(const std::string& file, Surface* surface)
{
int done;
int scroll, speed;
#ifndef SUPERTUX_TEXT_H
#define SUPERTUX_TEXT_H
+#include <string>
#include "texture.h"
-void display_text_file(char *file, char* surface);
-void display_text_file(char *file, Surface* surface);
+void display_text_file(const std::string& file, const std::string& surface);
+void display_text_file(const std::string& file, Surface* surface);
/* Kinds of texts. */
enum {
level.south = true;
level.west = true;
+ reader.read_string("extro-filename", &level.extro_filename);
reader.read_string("name", &level.name);
reader.read_int("x", &level.x);
reader.read_int("y", &level.y);
std::cout << "Walk to dir: " << dir << std::endl;
}
+
+ if (!level->extro_filename.empty())
+ { // Display final credits and go back to the main menu
+ display_text_file(level->extro_filename,
+ "/images/background/arctis2.jpg");
+ quit = true;
+ }
}
break;
std::string title;
bool solved;
+ /** Filename of the extro text to show once the level is
+ successfully completed */
+ std::string extro_filename;
+
// Directions which are walkable from this level
bool north;
bool east;