Thread: [Super-tux-commit] supertux/src gameloop.cpp,1.112,1.113 level.cpp,1.54,1.55 text.cpp,1.14,1.15 text
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-27 15:15:29
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21900 Modified Files: gameloop.cpp level.cpp text.cpp text.h worldmap.cpp worldmap.h Log Message: - added extro support to worldmap, crashes however, no idea why: 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 Index: text.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/text.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- text.cpp 26 Apr 2004 17:35:08 -0000 1.14 +++ text.cpp 27 Apr 2004 15:15:18 -0000 1.15 @@ -228,14 +228,14 @@ #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; Index: text.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/text.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- text.h 26 Apr 2004 14:15:48 -0000 1.13 +++ text.h 27 Apr 2004 15:15:18 -0000 1.14 @@ -21,10 +21,11 @@ #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 { Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- level.cpp 26 Apr 2004 19:11:54 -0000 1.54 +++ level.cpp 27 Apr 2004 15:15:17 -0000 1.55 @@ -282,22 +282,17 @@ 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; @@ -510,7 +505,6 @@ } lisp_free(root_obj); - fclose(fi); return 0; } Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- worldmap.cpp 26 Apr 2004 17:46:26 -0000 1.57 +++ worldmap.cpp 27 Apr 2004 15:15:18 -0000 1.58 @@ -420,6 +420,7 @@ 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); @@ -678,6 +679,13 @@ 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; Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- gameloop.cpp 27 Apr 2004 11:06:02 -0000 1.112 +++ gameloop.cpp 27 Apr 2004 15:15:16 -0000 1.113 @@ -413,9 +413,9 @@ 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())) Index: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- worldmap.h 26 Apr 2004 13:38:48 -0000 1.26 +++ worldmap.h 27 Apr 2004 15:15:18 -0000 1.27 @@ -153,6 +153,10 @@ 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; |