super-tux-commit Mailing List for Super Tux (Page 99)
Brought to you by:
wkendrick
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(94) |
Apr
(500) |
May
(531) |
Jun
(196) |
Jul
(224) |
Aug
(193) |
Sep
(117) |
Oct
(115) |
Nov
(319) |
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(19) |
Feb
|
Mar
(105) |
Apr
(41) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2007 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
(7) |
Oct
(12) |
Nov
(26) |
Dec
(39) |
2009 |
Jan
(6) |
Feb
(15) |
Mar
(10) |
Apr
(25) |
May
(29) |
Jun
(21) |
Jul
(26) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
(5) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17507 Modified Files: Makefile.am collision.cpp collision.h gameloop.cpp gameloop.h level.cpp level.h world.cpp world.h Log Message: - moved stuff from gamesession to world Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- world.h 10 Apr 2004 22:37:13 -0000 1.10 +++ world.h 11 Apr 2004 00:05:35 -0000 1.11 @@ -44,9 +44,11 @@ { base_type base; timer_type timer; + Tile* tile; }; -void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float xm, float ym); +void broken_brick_init(broken_brick_type* pbroken_brick, Tile* tile, + float x, float y, float xm, float ym); void broken_brick_action(broken_brick_type* pbroken_brick); void broken_brick_draw(broken_brick_type* pbroken_brick); @@ -93,6 +95,7 @@ { public: Level* level; + std::vector<bouncy_distro_type> bouncy_distros; std::vector<broken_brick_type> broken_bricks; std::vector<bouncy_brick_type> bouncy_bricks; @@ -104,14 +107,28 @@ public: World(); + ~World(); + + Level* get_level() { return level; } + void draw(); void action(); void arrays_free(); + /** Load data for this level: + Returns -1, if the loading of the level failed. */ + int load(const char* subset, int level); + + /** Load data for this level: + Returns -1, if the loading of the level failed. */ + int load(const std::string& filename); + + void activate_particle_systems(); + void add_score(float x, float y, int s); void add_bouncy_distro(float x, float y); - void add_broken_brick(float x, float y); - void add_broken_brick_piece(float x, float y, float xm, float ym); + void add_broken_brick(Tile* tile, float x, float y); + void add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym); void add_bouncy_brick(float x, float y); void add_bad_guy(float x, float y, BadGuyKind kind); void add_upgrade(float x, float y, int dir, int kind); Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.am 26 Mar 2004 23:53:31 -0000 1.13 +++ Makefile.am 11 Apr 2004 00:05:35 -0000 1.14 @@ -1,6 +1,7 @@ bin_PROGRAMS = supertux -supertux_SOURCES = badguy.cpp badguy.h bitmask.cpp bitmask.h button.cpp button.h collision.cpp collision.h configfile.cpp configfile.h defines.h gameloop.cpp gameloop.h globals.cpp globals.h high_scores.cpp high_scores.h intro.cpp intro.h level.cpp level.h leveleditor.cpp leveleditor.h lispreader.cpp lispreader.h menu.cpp menu.h particlesystem.cpp particlesystem.h physic.cpp physic.h player.cpp player.h scene.cpp scene.h screen.cpp screen.h setup.cpp setup.h sound.cpp sound.h special.cpp special.h supertux.cpp supertux.h text.cpp text.h texture.cpp texture.h timer.cpp timer.h title.cpp title.h type.cpp type.h world.cpp world.h worldmap.cpp worldmap.h tile.h tile.cpp mousecursor.cpp mousecursor.h +supertux_SOURCES = \ +badguy.cpp badguy.h bitmask.cpp bitmask.h button.cpp button.h collision.cpp collision.h configfile.cpp configfile.h defines.h gameloop.cpp gameloop.h globals.cpp globals.h high_scores.cpp high_scores.h intro.cpp intro.h level.cpp level.h leveleditor.cpp leveleditor.h lispreader.cpp lispreader.h menu.cpp menu.h particlesystem.cpp particlesystem.h physic.cpp physic.h player.cpp player.h scene.cpp scene.h screen.cpp screen.h setup.cpp setup.h sound.cpp sound.h special.cpp special.h supertux.cpp supertux.h text.cpp text.h texture.cpp texture.h timer.cpp timer.h title.cpp title.h type.cpp type.h world.cpp world.h worldmap.cpp worldmap.h tile.h tile.cpp mousecursor.cpp mousecursor.h resources.h resources.cpp # EOF # noinst_HEADERS = Index: collision.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- collision.cpp 10 Apr 2004 22:37:13 -0000 1.11 +++ collision.cpp 11 Apr 2004 00:05:35 -0000 1.12 @@ -14,6 +14,7 @@ #include "collision.h" #include "bitmask.h" #include "scene.h" +#include "tile.h" bool rectcollision(base_type* one, base_type* two) { @@ -279,7 +280,44 @@ upgrade_collision(&world.upgrades[i], &tux, CO_PLAYER); } } +} + + +Tile* gettile(float x, float y) +{ + return TileManager::instance()->get(GameSession::current()->get_level()->gettileid(x, y)); +} + +bool issolid(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->solid; +} + +bool isbrick(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->brick; +} +bool isice(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->ice; } +bool isfullbox(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->fullbox; +} + +bool isdistro(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->distro; +} + +/* EOF */ + Index: collision.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- collision.h 4 Apr 2004 00:32:10 -0000 1.6 +++ collision.h 11 Apr 2004 00:05:35 -0000 1.7 @@ -14,6 +14,8 @@ #include "type.h" +class Tile; + /* Collision objects */ enum { @@ -37,5 +39,14 @@ And calls the collision_handlers, which the collision_objects provide for this case (or not). */ void collision_handler(); +/** Return a pointer to the tile at the given x/y coordinates */ +Tile* gettile(float x, float y); + +// Some little helper function to check for tile properties +bool issolid(float x, float y); +bool isbrick(float x, float y); +bool isice(float x, float y); +bool isfullbox(float x, float y); + #endif /*SUPERTUX_COLLISION_H*/ Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- level.h 10 Apr 2004 22:01:26 -0000 1.20 +++ level.h 11 Apr 2004 00:05:35 -0000 1.21 @@ -51,10 +51,12 @@ }; extern texture_type img_bkgd; + +/* extern texture_type img_bkgd_tile[2][4]; extern texture_type img_solid[4]; extern texture_type img_brick[2]; - +*/ class Level { public: @@ -81,7 +83,12 @@ /** Cleanup the level struct from allocated tile data and such */ void cleanup(); + /** Load data for this level: + Returns -1, if the loading of the level failed. */ int load(const char* subset, int level); + + /** Load data for this level: + Returns -1, if the loading of the level failed. */ int load(const std::string& filename); void load_gfx(); @@ -103,13 +110,4 @@ void level_free_song(); void level_free_gfx(); -/** Return a pointer to the tile at the given x/y coordinates */ -Tile* gettile(float x, float y); - -// Some little helper function to check for tile properties -bool issolid(float x, float y); -bool isbrick(float x, float y); -bool isice(float x, float y); -bool isfullbox(float x, float y); - #endif /*SUPERTUX_LEVEL_H*/ Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- gameloop.h 10 Apr 2004 22:37:13 -0000 1.29 +++ gameloop.h 11 Apr 2004 00:05:35 -0000 1.30 @@ -16,6 +16,7 @@ #include "sound.h" #include "type.h" #include "level.h" +#include "world.h" /* GameLoop modes */ @@ -26,6 +27,8 @@ extern int game_started; +class World; + /** The GameSession class controlls the controll flow of a World, ie. present the menu on specifc keypresses, render and update it while keeping the speed and framerate sane, etc. */ @@ -33,18 +36,20 @@ { private: timer_type fps_timer, frame_timer; - Level current_level; + World* world; public: GameSession(); GameSession(const std::string& filename); GameSession(const std::string& subset, int levelnb, int mode); + int run(); void draw(); int action(); void process_events(); - Level* get_level() { return ¤t_level; } + Level* get_level() { return world->get_level(); } + World* get_world() { return world; } void savegame(int slot); void loadgame(int slot); @@ -55,7 +60,6 @@ void levelintro(); void start_timers(); - void activate_particle_systems(); }; void activate_bad_guys(Level* plevel); Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- level.cpp 10 Apr 2004 22:01:26 -0000 1.26 +++ level.cpp 11 Apr 2004 00:05:35 -0000 1.27 @@ -228,15 +228,12 @@ } } -/* Load data for this level: */ -/* Returns -1, if the loading of the level failed. */ int Level::load(const char *subset, int level) { char filename[1024]; - /* Load data file: */ - + // Load data file: snprintf(filename, 1024, "%s/levels/%s/level%d.stl", st_dir, subset, level); if(!faccessible(filename)) snprintf(filename, 1024, "%s/levels/%s/level%d.stl", datadir.c_str(), subset, level); @@ -708,39 +705,4 @@ return c; } -Tile* gettile(float x, float y) -{ - return TileManager::instance()->get(GameSession::current()->get_level()->gettileid(x, y)); -} - -bool issolid(float x, float y) -{ - Tile* tile = gettile(x,y); - return tile && tile->solid; -} - -bool isbrick(float x, float y) -{ - Tile* tile = gettile(x,y); - return tile && tile->brick; -} - -bool isice(float x, float y) -{ - Tile* tile = gettile(x,y); - return tile && tile->ice; -} - -bool isfullbox(float x, float y) -{ - Tile* tile = gettile(x,y); - return tile && tile->fullbox; -} - -bool isdistro(float x, float y) -{ - Tile* tile = gettile(x,y); - return tile && tile->distro; -} - /* EOF */ Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- world.cpp 10 Apr 2004 22:37:13 -0000 1.7 +++ world.cpp 11 Apr 2004 00:05:35 -0000 1.8 @@ -10,6 +10,7 @@ // // +#include <math.h> #include <stdlib.h> #include <string.h> #include "globals.h" @@ -25,7 +26,24 @@ World::World() { - + level = new Level; +} + +World::~World() +{ + delete level; +} + +int +World::load(const char* subset, int level_nr) +{ + return level->load(subset, level_nr); +} + +int +World::load(const std::string& filename) +{ + return level->load(filename); } void @@ -45,9 +63,74 @@ particle_systems.clear(); } + +void +World::activate_particle_systems() +{ + if (level->particle_system == "clouds") + { + particle_systems.push_back(new CloudParticleSystem); + } + else if (level->particle_system == "snow") + { + particle_systems.push_back(new SnowParticleSystem); + } + else if (level->particle_system != "") + { + st_abort("unknown particle system specified in level", ""); + } +} + void World::draw() { + int y,x; + + /* Draw screen: */ + if(timer_check(&super_bkgd_timer)) + texture_draw(&img_super_bkgd, 0, 0); + else + { + /* Draw the real background */ + if(get_level()->bkgd_image[0] != '\0') + { + int s = (int)scroll_x / 30; + texture_draw_part(&img_bkgd,s,0,0,0,img_bkgd.w - s, img_bkgd.h); + texture_draw_part(&img_bkgd,0,0,screen->w - s ,0,s,img_bkgd.h); + } + else + { + clearscreen(level->bkgd_red, level->bkgd_green, level->bkgd_blue); + } + } + + /* Draw particle systems (background) */ + std::vector<ParticleSystem*>::iterator p; + for(p = particle_systems.begin(); p != particle_systems.end(); ++p) + { + (*p)->draw(scroll_x, 0, 0); + } + + /* Draw background: */ + for (y = 0; y < 15; ++y) + { + for (x = 0; x < 21; ++x) + { + drawshape(32*x - fmodf(scroll_x, 32), y * 32, + level->bg_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); + } + } + + /* Draw interactive tiles: */ + for (y = 0; y < 15; ++y) + { + for (x = 0; x < 21; ++x) + { + drawshape(32*x - fmodf(scroll_x, 32), y * 32, + level->ia_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); + } + } + /* (Bouncy bricks): */ for (unsigned int i = 0; i < bouncy_bricks.size(); ++i) bouncy_brick_draw(&bouncy_bricks[i]); @@ -68,6 +151,25 @@ for (unsigned int i = 0; i < bouncy_distros.size(); ++i) bouncy_distro_draw(&bouncy_distros[i]); + + for (unsigned int i = 0; i < broken_bricks.size(); ++i) + broken_brick_draw(&broken_bricks[i]); + + /* Draw foreground: */ + for (y = 0; y < 15; ++y) + { + for (x = 0; x < 21; ++x) + { + drawshape(32*x - fmodf(scroll_x, 32), y * 32, + level->fg_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); + } + } + + /* Draw particle systems (foreground) */ + for(p = particle_systems.begin(); p != particle_systems.end(); ++p) + { + (*p)->draw(scroll_x, 0, 1); + } } void @@ -126,20 +228,20 @@ } void -World::add_broken_brick(float x, float y) +World::add_broken_brick(Tile* tile, float x, float y) { - add_broken_brick_piece(x, y, -1, -4); - add_broken_brick_piece(x, y + 16, -1.5, -3); + add_broken_brick_piece(tile, x, y, -1, -4); + add_broken_brick_piece(tile, x, y + 16, -1.5, -3); - add_broken_brick_piece(x + 16, y, 1, -4); - add_broken_brick_piece(x + 16, y + 16, 1.5, -3); + add_broken_brick_piece(tile, x + 16, y, 1, -4); + add_broken_brick_piece(tile, x + 16, y + 16, 1.5, -3); } void -World::add_broken_brick_piece(float x, float y, float xm, float ym) +World::add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym) { broken_brick_type new_broken_brick; - broken_brick_init(&new_broken_brick,x,y,xm,ym); + broken_brick_init(&new_broken_brick, tile, x, y, xm, ym); broken_bricks.push_back(new_broken_brick); } @@ -204,12 +306,15 @@ pbouncy_distro->base.y); } -void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float xm, float ym) +void broken_brick_init(broken_brick_type* pbroken_brick, Tile* tile, + float x, float y, float xm, float ym) { + pbroken_brick->tile = tile; pbroken_brick->base.x = x; pbroken_brick->base.y = y; pbroken_brick->base.xm = xm; pbroken_brick->base.ym = ym; + timer_init(&pbroken_brick->timer, true); timer_start(&pbroken_brick->timer,200); } @@ -235,8 +340,10 @@ dest.y = (int)pbroken_brick->base.y; dest.w = 16; dest.h = 16; - - texture_draw_part(&img_brick[0],src.x,src.y,dest.x,dest.y,dest.w,dest.h); + + if (pbroken_brick->tile->images.size() > 0) + texture_draw_part(&pbroken_brick->tile->images[0], + src.x,src.y,dest.x,dest.y,dest.w,dest.h); } void bouncy_brick_init(bouncy_brick_type* pbouncy_brick, float x, float y) @@ -358,8 +465,9 @@ plevel->change(x, y, TM_IA, tile->next_tile); /* Replace it with broken bits: */ - world.add_broken_brick(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); + world.add_broken_brick(tile, + ((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); /* Get some score: */ play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- gameloop.cpp 10 Apr 2004 22:37:13 -0000 1.50 +++ gameloop.cpp 11 Apr 2004 00:05:35 -0000 1.51 @@ -48,9 +48,6 @@ int game_started = false; /* Local variables: */ - -static texture_type img_waves[3], img_water, img_pole, img_poletop, img_flag[2]; -static texture_type img_cloud[2][4]; static SDL_Event event; static SDLKey key; static char level_subset[100]; @@ -81,16 +78,20 @@ { current_ = this; + world = &::world; + timer_init(&fps_timer, true); timer_init(&frame_timer, true); - current_level.load(filename); + world->load(filename); } GameSession::GameSession(const std::string& subset, int levelnb, int mode) { current_ = this; + world = &::world; + timer_init(&fps_timer, true); timer_init(&frame_timer, true); @@ -100,27 +101,27 @@ level = levelnb; /* Init the game: */ - world.arrays_free(); + world->arrays_free(); set_defaults(); strcpy(level_subset, subset.c_str()); if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) { - if (current_level.load(level_subset)) + if (world->load(level_subset)) exit(1); } else { - if(current_level.load(level_subset, level) != 0) + if(world->load(level_subset, level) != 0) exit(1); } - current_level.load_gfx(); + world->get_level()->load_gfx(); loadshared(); - activate_bad_guys(¤t_level); - activate_particle_systems(); - current_level.load_song(); + activate_bad_guys(world->get_level()); + world->activate_particle_systems(); + world->get_level()->load_song(); tux.init(); @@ -147,7 +148,7 @@ sprintf(str, "LEVEL %d", level); text_drawf(&blue_text, str, 0, 200, A_HMIDDLE, A_TOP, 1); - sprintf(str, "%s", current_level.name.c_str()); + sprintf(str, "%s", world->get_level()->name.c_str()); text_drawf(&gold_text, str, 0, 224, A_HMIDDLE, A_TOP, 1); sprintf(str, "TUX x %d", tux.lives); @@ -163,7 +164,7 @@ void GameSession::start_timers() { - timer_start(&time_left,current_level.time_left*1000); + timer_start(&time_left, world->get_level()->time_left*1000); st_pause_ticks_init(); update_time = st_get_ticks(); } @@ -179,30 +180,14 @@ } void -GameSession::activate_particle_systems() -{ - if(current_level.particle_system == "clouds") - { - world.particle_systems.push_back(new CloudParticleSystem); - } - else if(current_level.particle_system == "snow") - { - world.particle_systems.push_back(new SnowParticleSystem); - } - else if(current_level.particle_system != "") - { - st_abort("unknown particle system specified in level", ""); - } -} - -void GameSession::process_events() { while (SDL_PollEvent(&event)) { - /* Check for menu-events, if the menu is shown */ - if(show_menu) - menu_event(event); + /* Check for menu-events, if the menu is shown */ + if(show_menu) + menu_event(event); + switch(event.type) { case SDL_QUIT: /* Quit event - quit: */ @@ -369,10 +354,8 @@ if (tux.is_dead() || next_level) { /* Tux either died, or reached the end of a level! */ - halt_music(); - - + if (next_level) { /* End of a level! */ @@ -385,10 +368,10 @@ else { level_free_gfx(); - current_level.cleanup(); + world->get_level()->cleanup(); level_free_song(); unloadshared(); - world.arrays_free(); + world->arrays_free(); return(0); } tux.level_begin(); @@ -410,10 +393,10 @@ save_hs(score); } level_free_gfx(); - current_level.cleanup(); + world->get_level()->cleanup(); level_free_song(); unloadshared(); - world.arrays_free(); + world->arrays_free(); return(0); } /* if (lives < 0) */ } @@ -422,26 +405,26 @@ tux.level_begin(); set_defaults(); - current_level.cleanup(); + world->get_level()->cleanup(); if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) { - if(current_level.load(level_subset) != 0) + if(world->get_level()->load(level_subset) != 0) return 0; } else { - if(current_level.load(level_subset,level) != 0) + if(world->get_level()->load(level_subset,level) != 0) return 0; } - world.arrays_free(); - activate_bad_guys(¤t_level); - activate_particle_systems(); + world->arrays_free(); + activate_bad_guys(world->get_level()); + world->activate_particle_systems(); level_free_gfx(); - current_level.load_gfx(); + world->get_level()->load_gfx(); level_free_song(); - current_level.load_song(); + world->get_level()->load_song(); if(st_gl_mode != ST_GL_TEST) levelintro(); start_timers(); @@ -451,11 +434,11 @@ tux.action(); - world.action(); + world->action(); /* update particle systems */ std::vector<ParticleSystem*>::iterator p; - for(p = world.particle_systems.begin(); p != world.particle_systems.end(); ++p) + for(p = world->particle_systems.begin(); p != world->particle_systems.end(); ++p) { (*p)->simulate(frame_ratio); } @@ -469,73 +452,9 @@ void GameSession::draw() { - int y,x; - /* Draw screen: */ - if(timer_check(&super_bkgd_timer)) - texture_draw(&img_super_bkgd, 0, 0); - else - { - /* Draw the real background */ - if(current_level.bkgd_image[0] != '\0') - { - int s = (int)scroll_x / 30; - texture_draw_part(&img_bkgd,s,0,0,0,img_bkgd.w - s, img_bkgd.h); - texture_draw_part(&img_bkgd,0,0,screen->w - s ,0,s,img_bkgd.h); - } - else - { - clearscreen(current_level.bkgd_red, current_level.bkgd_green, current_level.bkgd_blue); - } - } - - /* Draw particle systems (background) */ - std::vector<ParticleSystem*>::iterator p; - for(p = world.particle_systems.begin(); p != world.particle_systems.end(); ++p) - { - (*p)->draw(scroll_x, 0, 0); - } - - /* Draw background: */ - for (y = 0; y < 15; ++y) - { - for (x = 0; x < 21; ++x) - { - drawshape(32*x - fmodf(scroll_x, 32), y * 32, - current_level.bg_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); - } - } - - /* Draw interactive tiles: */ - for (y = 0; y < 15; ++y) - { - for (x = 0; x < 21; ++x) - { - drawshape(32*x - fmodf(scroll_x, 32), y * 32, - current_level.ia_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); - } - } - world.draw(); - - for (unsigned int i = 0; i < world.broken_bricks.size(); ++i) - broken_brick_draw(&world.broken_bricks[i]); - - /* Draw foreground: */ - for (y = 0; y < 15; ++y) - { - for (x = 0; x < 21; ++x) - { - drawshape(32*x - fmodf(scroll_x, 32), y * 32, - current_level.fg_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); - } - } - - /* Draw particle systems (foreground) */ - for(p = world.particle_systems.begin(); p != world.particle_systems.end(); ++p) - { - (*p)->draw(scroll_x, 0, 1); - } + world->draw(); drawstatus(); @@ -743,370 +662,16 @@ halt_music(); level_free_gfx(); - current_level.cleanup(); + world->get_level()->cleanup(); level_free_song(); unloadshared(); - world.arrays_free(); + world->arrays_free(); game_started = false; return(quit); } -/* Load graphics/sounds shared between all levels: */ -void loadshared() -{ - int i; - - /* Tuxes: */ - texture_load(&smalltux_stand_left, datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA); - texture_load(&smalltux_stand_right, datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA); - - texture_load(&smalltux_jump_left, datadir + "/images/shared/smalltux-jump-left.png", USE_ALPHA); - texture_load(&smalltux_jump_right, datadir + "/images/shared/smalltux-jump-right.png", USE_ALPHA); - - tux_right.resize(8); - texture_load(&tux_right[0], datadir + "/images/shared/smalltux-right-1.png", USE_ALPHA); - texture_load(&tux_right[1], datadir + "/images/shared/smalltux-right-2.png", USE_ALPHA); - texture_load(&tux_right[2], datadir + "/images/shared/smalltux-right-3.png", USE_ALPHA); - texture_load(&tux_right[3], datadir + "/images/shared/smalltux-right-4.png", USE_ALPHA); - texture_load(&tux_right[4], datadir + "/images/shared/smalltux-right-5.png", USE_ALPHA); - texture_load(&tux_right[5], datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA); - texture_load(&tux_right[6], datadir + "/images/shared/smalltux-right-7.png", USE_ALPHA); - texture_load(&tux_right[7], datadir + "/images/shared/smalltux-right-8.png", USE_ALPHA); - - tux_left.resize(8); - texture_load(&tux_left[0], datadir + "/images/shared/smalltux-left-1.png", USE_ALPHA); - texture_load(&tux_left[1], datadir + "/images/shared/smalltux-left-2.png", USE_ALPHA); - texture_load(&tux_left[2], datadir + "/images/shared/smalltux-left-3.png", USE_ALPHA); - texture_load(&tux_left[3], datadir + "/images/shared/smalltux-left-4.png", USE_ALPHA); - texture_load(&tux_left[4], datadir + "/images/shared/smalltux-left-5.png", USE_ALPHA); - texture_load(&tux_left[5], datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA); - texture_load(&tux_left[6], datadir + "/images/shared/smalltux-left-7.png", USE_ALPHA); - texture_load(&tux_left[7], datadir + "/images/shared/smalltux-left-8.png", USE_ALPHA); - - texture_load(&firetux_right[0], datadir + "/images/shared/firetux-right-0.png", USE_ALPHA); - texture_load(&firetux_right[1], datadir + "/images/shared/firetux-right-1.png", USE_ALPHA); - texture_load(&firetux_right[2], datadir + "/images/shared/firetux-right-2.png", USE_ALPHA); - - texture_load(&firetux_left[0], datadir + "/images/shared/firetux-left-0.png", USE_ALPHA); - texture_load(&firetux_left[1], datadir + "/images/shared/firetux-left-1.png", USE_ALPHA); - texture_load(&firetux_left[2], datadir + "/images/shared/firetux-left-2.png", USE_ALPHA); - - - texture_load(&cape_right[0], datadir + "/images/shared/cape-right-0.png", - USE_ALPHA); - - texture_load(&cape_right[1], datadir + "/images/shared/cape-right-1.png", - USE_ALPHA); - - texture_load(&cape_left[0], datadir + "/images/shared/cape-left-0.png", - USE_ALPHA); - - texture_load(&cape_left[1], datadir + "/images/shared/cape-left-1.png", - USE_ALPHA); - - texture_load(&bigtux_right[0], datadir + "/images/shared/bigtux-right-0.png", - USE_ALPHA); - - texture_load(&bigtux_right[1], datadir + "/images/shared/bigtux-right-1.png", - USE_ALPHA); - - texture_load(&bigtux_right[2], datadir + "/images/shared/bigtux-right-2.png", - USE_ALPHA); - - texture_load(&bigtux_right_jump, datadir + "/images/shared/bigtux-right-jump.png", USE_ALPHA); - - texture_load(&bigtux_left[0], datadir + "/images/shared/bigtux-left-0.png", - USE_ALPHA); - - texture_load(&bigtux_left[1], datadir + "/images/shared/bigtux-left-1.png", - USE_ALPHA); - - texture_load(&bigtux_left[2], datadir + "/images/shared/bigtux-left-2.png", - USE_ALPHA); - - texture_load(&bigtux_left_jump, datadir + "/images/shared/bigtux-left-jump.png", USE_ALPHA); - - texture_load(&bigcape_right[0], datadir + "/images/shared/bigcape-right-0.png", - USE_ALPHA); - - texture_load(&bigcape_right[1], datadir + "/images/shared/bigcape-right-1.png", - USE_ALPHA); - - texture_load(&bigcape_left[0], datadir + "/images/shared/bigcape-left-0.png", - USE_ALPHA); - - texture_load(&bigcape_left[1], datadir + "/images/shared/bigcape-left-1.png", - USE_ALPHA); - - texture_load(&bigfiretux_right[0], datadir + "/images/shared/bigfiretux-right-0.png", - USE_ALPHA); - - texture_load(&bigfiretux_right[1], datadir + "/images/shared/bigfiretux-right-1.png", - USE_ALPHA); - - texture_load(&bigfiretux_right[2], datadir + "/images/shared/bigfiretux-right-2.png", - USE_ALPHA); - - texture_load(&bigfiretux_right_jump, datadir + "/images/shared/bigfiretux-right-jump.png", USE_ALPHA); - - texture_load(&bigfiretux_left[0], datadir + "/images/shared/bigfiretux-left-0.png", - USE_ALPHA); - - texture_load(&bigfiretux_left[1], datadir + "/images/shared/bigfiretux-left-1.png", - USE_ALPHA); - - texture_load(&bigfiretux_left[2], datadir + "/images/shared/bigfiretux-left-2.png", - USE_ALPHA); - - texture_load(&bigfiretux_left_jump, datadir + "/images/shared/bigfiretux-left-jump.png", USE_ALPHA); - - texture_load(&bigcape_right[0], datadir + "/images/shared/bigcape-right-0.png", - USE_ALPHA); - - texture_load(&bigcape_right[1], datadir + "/images/shared/bigcape-right-1.png", - USE_ALPHA); - - texture_load(&bigcape_left[0], datadir + "/images/shared/bigcape-left-0.png", - USE_ALPHA); - - texture_load(&bigcape_left[1], datadir + "/images/shared/bigcape-left-1.png", - USE_ALPHA); - - - texture_load(&ducktux_right, datadir + - "/images/shared/ducktux-right.png", - USE_ALPHA); - - texture_load(&ducktux_left, datadir + - "/images/shared/ducktux-left.png", - USE_ALPHA); - - texture_load(&skidtux_right, datadir + - "/images/shared/skidtux-right.png", - USE_ALPHA); - - texture_load(&skidtux_left, datadir + - "/images/shared/skidtux-left.png", - USE_ALPHA); - - texture_load(&duckfiretux_right, datadir + - "/images/shared/duckfiretux-right.png", - USE_ALPHA); - - texture_load(&duckfiretux_left, datadir + - "/images/shared/duckfiretux-left.png", - USE_ALPHA); - - texture_load(&skidfiretux_right, datadir + - "/images/shared/skidfiretux-right.png", - USE_ALPHA); - - texture_load(&skidfiretux_left, datadir + - "/images/shared/skidfiretux-left.png", - USE_ALPHA); - - - /* Boxes: */ - - texture_load(&img_box_full, datadir + "/images/shared/box-full.png", - IGNORE_ALPHA); - texture_load(&img_box_empty, datadir + "/images/shared/box-empty.png", - IGNORE_ALPHA); - - - /* Water: */ - - - texture_load(&img_water, datadir + "/images/shared/water.png", IGNORE_ALPHA); - - texture_load(&img_waves[0], datadir + "/images/shared/waves-0.png", - USE_ALPHA); - - texture_load(&img_waves[1], datadir + "/images/shared/waves-1.png", - USE_ALPHA); - - texture_load(&img_waves[2], datadir + "/images/shared/waves-2.png", - USE_ALPHA); - - - /* Pole: */ - - texture_load(&img_pole, datadir + "/images/shared/pole.png", USE_ALPHA); - texture_load(&img_poletop, datadir + "/images/shared/poletop.png", - USE_ALPHA); - - - /* Flag: */ - - texture_load(&img_flag[0], datadir + "/images/shared/flag-0.png", - USE_ALPHA); - texture_load(&img_flag[1], datadir + "/images/shared/flag-1.png", - USE_ALPHA); - - - /* Cloud: */ - - texture_load(&img_cloud[0][0], datadir + "/images/shared/cloud-00.png", - USE_ALPHA); - - texture_load(&img_cloud[0][1], datadir + "/images/shared/cloud-01.png", - USE_ALPHA); - - texture_load(&img_cloud[0][2], datadir + "/images/shared/cloud-02.png", - USE_ALPHA); - - texture_load(&img_cloud[0][3], datadir + "/images/shared/cloud-03.png", - USE_ALPHA); - - - texture_load(&img_cloud[1][0], datadir + "/images/shared/cloud-10.png", - USE_ALPHA); - - texture_load(&img_cloud[1][1], datadir + "/images/shared/cloud-11.png", - USE_ALPHA); - - texture_load(&img_cloud[1][2], datadir + "/images/shared/cloud-12.png", - USE_ALPHA); - - texture_load(&img_cloud[1][3], datadir + "/images/shared/cloud-13.png", - USE_ALPHA); - - - /* Bad guys: */ - load_badguy_gfx(); - - /* Upgrades: */ - - texture_load(&img_mints, datadir + "/images/shared/mints.png", USE_ALPHA); - texture_load(&img_coffee, datadir + "/images/shared/coffee.png", USE_ALPHA); - - - /* Weapons: */ - - texture_load(&img_bullet, datadir + "/images/shared/bullet.png", USE_ALPHA); - - texture_load(&img_red_glow, datadir + "/images/shared/red-glow.png", - USE_ALPHA); - - - - /* Distros: */ - - texture_load(&img_distro[0], datadir + "/images/shared/distro-0.png", - USE_ALPHA); - - texture_load(&img_distro[1], datadir + "/images/shared/distro-1.png", - USE_ALPHA); - - texture_load(&img_distro[2], datadir + "/images/shared/distro-2.png", - USE_ALPHA); - - texture_load(&img_distro[3], datadir + "/images/shared/distro-3.png", - USE_ALPHA); - - - /* Tux life: */ - - texture_load(&tux_life, datadir + "/images/shared/tux-life.png", - USE_ALPHA); - - /* Herring: */ - - texture_load(&img_golden_herring, datadir + "/images/shared/golden-herring.png", - USE_ALPHA); - - - /* Super background: */ - - texture_load(&img_super_bkgd, datadir + "/images/shared/super-bkgd.png", - IGNORE_ALPHA); - - - /* Sound effects: */ - - /* if (use_sound) // this will introduce SERIOUS bugs here ! because "load_sound" - // initialize sounds[i] with the correct pointer's value: - // NULL or something else. And it will be dangerous to - // play with not-initialized pointers. - // This is also true with if (use_music) - Send a mail to me: neo...@us..., if you have another opinion. :) - */ - for (i = 0; i < NUM_SOUNDS; i++) - sounds[i] = load_sound(datadir + soundfilenames[i]); - - /* Herring song */ - herring_song = load_song(datadir + "/music/SALCON.MOD"); -} - - -/* Free shared data: */ - -void unloadshared(void) -{ - int i; - - for (i = 0; i < 3; i++) - { - texture_free(&tux_right[i]); - texture_free(&tux_left[i]); - texture_free(&bigtux_right[i]); - texture_free(&bigtux_left[i]); - } - - texture_free(&bigtux_right_jump); - texture_free(&bigtux_left_jump); - - for (i = 0; i < 2; i++) - { - texture_free(&cape_right[i]); - texture_free(&cape_left[i]); - texture_free(&bigcape_right[i]); - texture_free(&bigcape_left[i]); - } - - texture_free(&ducktux_left); - texture_free(&ducktux_right); - - texture_free(&skidtux_left); - texture_free(&skidtux_right); - - free_badguy_gfx(); - - texture_free(&img_box_full); - texture_free(&img_box_empty); - - texture_free(&img_water); - for (i = 0; i < 3; i++) - texture_free(&img_waves[i]); - - texture_free(&img_pole); - texture_free(&img_poletop); - - for (i = 0; i < 2; i++) - texture_free(&img_flag[i]); - - texture_free(&img_mints); - texture_free(&img_coffee); - - for (i = 0; i < 4; i++) - { - texture_free(&img_distro[i]); - texture_free(&img_cloud[0][i]); - texture_free(&img_cloud[1][i]); - } - - texture_free(&img_golden_herring); - - for (i = 0; i < NUM_SOUNDS; i++) - free_chunk(sounds[i]); - - /* free the herring song */ - free_music( herring_song ); -} - - /* Draw a tile on the screen: */ void drawshape(float x, float y, unsigned int c, Uint8 alpha) @@ -1289,16 +854,16 @@ fread(&level,sizeof(int),1,fi); set_defaults(); - current_level.cleanup(); - if(current_level.load(level_subset,level) != 0) + world->get_level()->cleanup(); + if(world->get_level()->load(level_subset,level) != 0) exit(1); - world.arrays_free(); - activate_bad_guys(¤t_level); - activate_particle_systems(); + world->arrays_free(); + activate_bad_guys(world->get_level()); + world->activate_particle_systems(); level_free_gfx(); - current_level.load_gfx(); + world->get_level()->load_gfx(); level_free_song(); - current_level.load_song(); + world->get_level()->load_song(); levelintro(); update_time = st_get_ticks(); |
From: Ingo R. <gr...@us...> - 2004-04-10 22:50:47
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3825 Modified Files: badguy.cpp collision.cpp gameloop.cpp gameloop.h leveleditor.cpp player.cpp scene.cpp scene.h special.cpp world.cpp world.h Log Message: - moved stuff from scene into a World class, just an intermediate step, more cleanup will follow Index: scene.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/scene.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- scene.cpp 10 Apr 2004 19:40:49 -0000 1.12 +++ scene.cpp 10 Apr 2004 22:37:13 -0000 1.13 @@ -27,14 +27,6 @@ float scroll_x; unsigned int global_frame_counter; -std::vector<bouncy_distro_type> bouncy_distros; -std::vector<broken_brick_type> broken_bricks; -std::vector<bouncy_brick_type> bouncy_bricks; -std::vector<BadGuy> bad_guys; -std::vector<floating_score_type> floating_scores; -std::vector<upgrade_type> upgrades; -std::vector<bullet_type> bullets; -std::vector<ParticleSystem*> particle_systems; Player tux; texture_type img_box_full; texture_type img_box_empty; @@ -45,22 +37,6 @@ timer_type time_left; double frame_ratio; -void arrays_free(void) -{ - bad_guys.clear(); - bouncy_distros.clear(); - broken_bricks.clear(); - bouncy_bricks.clear(); - floating_scores.clear(); - upgrades.clear(); - bullets.clear(); - std::vector<ParticleSystem*>::iterator i; - for(i = particle_systems.begin(); i != particle_systems.end(); ++i) { - delete *i; - } - particle_systems.clear(); -} - void set_defaults(void) { // Set defaults: @@ -78,69 +54,5 @@ set_current_music(LEVEL_MUSIC); } -void add_score(float x, float y, int s) -{ - score += s; - - floating_score_type new_floating_score; - floating_score_init(&new_floating_score,x,y,s); - floating_scores.push_back(new_floating_score); -} - -void add_bouncy_distro(float x, float y) -{ - - bouncy_distro_type new_bouncy_distro; - bouncy_distro_init(&new_bouncy_distro,x,y); - bouncy_distros.push_back(new_bouncy_distro); -} - -void add_broken_brick(float x, float y) -{ - add_broken_brick_piece(x, y, -1, -4); - add_broken_brick_piece(x, y + 16, -1.5, -3); - - add_broken_brick_piece(x + 16, y, 1, -4); - add_broken_brick_piece(x + 16, y + 16, 1.5, -3); -} - -void add_broken_brick_piece(float x, float y, float xm, float ym) -{ - broken_brick_type new_broken_brick; - broken_brick_init(&new_broken_brick,x,y,xm,ym); - broken_bricks.push_back(new_broken_brick); -} - -void add_bouncy_brick(float x, float y) -{ - bouncy_brick_type new_bouncy_brick; - bouncy_brick_init(&new_bouncy_brick,x,y); - bouncy_bricks.push_back(new_bouncy_brick); -} - -void add_bad_guy(float x, float y, BadGuyKind kind) -{ - bad_guys.push_back(BadGuy()); - BadGuy& new_bad_guy = bad_guys.back(); - - new_bad_guy.init(x,y,kind); -} - -void add_upgrade(float x, float y, int dir, int kind) -{ - upgrade_type new_upgrade; - upgrade_init(&new_upgrade,x,y,dir,kind); - upgrades.push_back(new_upgrade); -} - -void add_bullet(float x, float y, float xm, int dir) -{ - bullet_type new_bullet; - bullet_init(&new_bullet,x,y,xm,dir); - bullets.push_back(new_bullet); - - play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER); -} - // EOF // Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- world.h 10 Apr 2004 22:01:27 -0000 1.9 +++ world.h 10 Apr 2004 22:37:13 -0000 1.10 @@ -13,8 +13,12 @@ #ifndef SUPERTUX_WORLD_H #define SUPERTUX_WORLD_H +#include <vector> #include <SDL.h> #include "type.h" +#include "scene.h" +#include "special.h" +#include "particlesystem.h" /* Bounciness of distros: */ @@ -69,7 +73,6 @@ void floating_score_action(floating_score_type* pfloating_score); void floating_score_draw(floating_score_type* pfloating_score); - /** Try to grab the coin at the given coordinates */ void trygrabdistro(float x, float y, int bounciness); @@ -83,5 +86,39 @@ the tile which the badguy is walking on an killing him this way */ void trybumpbadguy(float x, float y); + +/** The World class holds a level and all the game objects (badguys, + bouncy distros, etc) that are needed to run a game. */ +class World +{ + public: + Level* level; + std::vector<bouncy_distro_type> bouncy_distros; + std::vector<broken_brick_type> broken_bricks; + std::vector<bouncy_brick_type> bouncy_bricks; + std::vector<BadGuy> bad_guys; + std::vector<floating_score_type> floating_scores; + std::vector<upgrade_type> upgrades; + std::vector<bullet_type> bullets; + std::vector<ParticleSystem*> particle_systems; + + public: + World(); + void draw(); + void action(); + void arrays_free(); + + void add_score(float x, float y, int s); + void add_bouncy_distro(float x, float y); + void add_broken_brick(float x, float y); + void add_broken_brick_piece(float x, float y, float xm, float ym); + void add_bouncy_brick(float x, float y); + void add_bad_guy(float x, float y, BadGuyKind kind); + void add_upgrade(float x, float y, int dir, int kind); + void add_bullet(float x, float y, float xm, int dir); +}; + +extern World world; + #endif /*SUPERTUX_WORLD_H*/ Index: special.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- special.cpp 10 Apr 2004 22:01:27 -0000 1.7 +++ special.cpp 10 Apr 2004 22:37:13 -0000 1.8 @@ -72,7 +72,7 @@ issolid(pbullet->base.x + 4, pbullet->base.y + 2) || issolid(pbullet->base.x, pbullet->base.y + 2)) { - bullets.erase(static_cast<std::vector<bullet_type>::iterator>(pbullet)); + world.bullets.erase(static_cast<std::vector<bullet_type>::iterator>(pbullet)); } } @@ -91,9 +91,10 @@ { if(c_object == CO_BADGUY) { std::vector<bullet_type>::iterator i; - for(i = bullets.begin(); i != bullets.end(); ++i) { + + for(i = world.bullets.begin(); i != world.bullets.end(); ++i) { if(& (*i) == pbullet) { - bullets.erase(i); + world.bullets.erase(i); return; } } @@ -143,9 +144,9 @@ /* Off the screen? Kill it! */ if (pupgrade->base.x < scroll_x - pupgrade->base.width) - upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); + world.upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); if (pupgrade->base.y > screen->h) - upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); + world.upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); if (issolid(pupgrade->base.x + 1, pupgrade->base.y + 32.) || issolid(pupgrade->base.x + 31., pupgrade->base.y + 32.)) @@ -233,7 +234,7 @@ /* p_c_object is CO_PLAYER, so assign it to pplayer */ pplayer = (Player*) p_c_object; - upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); + world.upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); /* Affect the player: */ Index: scene.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/scene.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- scene.h 29 Mar 2004 13:24:42 -0000 1.15 +++ scene.h 10 Apr 2004 22:37:13 -0000 1.16 @@ -38,29 +38,12 @@ extern timer_type super_bkgd_timer; extern float scroll_x; extern unsigned int global_frame_counter; -extern std::vector<bouncy_distro_type> bouncy_distros; -extern std::vector<broken_brick_type> broken_bricks; -extern std::vector<bouncy_brick_type> bouncy_bricks; -extern std::vector<BadGuy> bad_guys; -extern std::vector<floating_score_type> floating_scores; -extern std::vector<upgrade_type> upgrades; -extern std::vector<bullet_type> bullets; -extern std::vector<ParticleSystem*> particle_systems; + extern Player tux; extern texture_type img_box_full, img_box_empty, img_mints, img_coffee, img_super_bkgd, img_red_glow; extern timer_type time_left; extern double frame_ratio; -void add_score(float x, float y, int s); void set_defaults(void); -void arrays_free(void); - -void add_bouncy_distro(float x, float y); -void add_broken_brick(float x, float y); -void add_broken_brick_piece(float x, float y, float xm, float ym); -void add_bouncy_brick(float x, float y); -void add_bad_guy(float x, float y, BadGuyKind kind); -void add_upgrade(float x, float y, int dir, int kind); -void add_bullet(float x, float y, float xm, int dir); #endif /*SUPERTUX_SCENE_H*/ Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- gameloop.cpp 10 Apr 2004 22:01:26 -0000 1.49 +++ gameloop.cpp 10 Apr 2004 22:37:13 -0000 1.50 @@ -100,7 +100,7 @@ level = levelnb; /* Init the game: */ - arrays_free(); + world.arrays_free(); set_defaults(); strcpy(level_subset, subset.c_str()); @@ -174,7 +174,7 @@ i != plevel->badguy_data.end(); ++i) { - add_bad_guy(i->x, i->y, i->kind); + world.add_bad_guy(i->x, i->y, i->kind); } } @@ -183,11 +183,11 @@ { if(current_level.particle_system == "clouds") { - particle_systems.push_back(new CloudParticleSystem); + world.particle_systems.push_back(new CloudParticleSystem); } else if(current_level.particle_system == "snow") { - particle_systems.push_back(new SnowParticleSystem); + world.particle_systems.push_back(new SnowParticleSystem); } else if(current_level.particle_system != "") { @@ -388,7 +388,7 @@ current_level.cleanup(); level_free_song(); unloadshared(); - arrays_free(); + world.arrays_free(); return(0); } tux.level_begin(); @@ -413,7 +413,7 @@ current_level.cleanup(); level_free_song(); unloadshared(); - arrays_free(); + world.arrays_free(); return(0); } /* if (lives < 0) */ } @@ -435,7 +435,7 @@ return 0; } - arrays_free(); + world.arrays_free(); activate_bad_guys(¤t_level); activate_particle_systems(); level_free_gfx(); @@ -451,42 +451,11 @@ tux.action(); - /* Handle bouncy distros: */ - for (unsigned int i = 0; i < bouncy_distros.size(); i++) - bouncy_distro_action(&bouncy_distros[i]); - - /* Handle broken bricks: */ - for (unsigned int i = 0; i < broken_bricks.size(); i++) - broken_brick_action(&broken_bricks[i]); - - /* Handle distro counting: */ - if (counting_distros) - { - distro_counter--; - - if (distro_counter <= 0) - counting_distros = -1; - } - - // Handle all kinds of game objects - for (unsigned int i = 0; i < bouncy_bricks.size(); i++) - bouncy_brick_action(&bouncy_bricks[i]); - - for (unsigned int i = 0; i < floating_scores.size(); i++) - floating_score_action(&floating_scores[i]); - - for (unsigned int i = 0; i < bullets.size(); ++i) - bullet_action(&bullets[i]); - - for (unsigned int i = 0; i < upgrades.size(); i++) - upgrade_action(&upgrades[i]); - - for (unsigned int i = 0; i < bad_guys.size(); i++) - bad_guys[i].action(); + world.action(); /* update particle systems */ std::vector<ParticleSystem*>::iterator p; - for(p = particle_systems.begin(); p != particle_systems.end(); ++p) + for(p = world.particle_systems.begin(); p != world.particle_systems.end(); ++p) { (*p)->simulate(frame_ratio); } @@ -497,8 +466,6 @@ return -1; } -/* --- GAME DRAW! --- */ - void GameSession::draw() { @@ -524,13 +491,12 @@ /* Draw particle systems (background) */ std::vector<ParticleSystem*>::iterator p; - for(p = particle_systems.begin(); p != particle_systems.end(); ++p) + for(p = world.particle_systems.begin(); p != world.particle_systems.end(); ++p) { (*p)->draw(scroll_x, 0, 0); } /* Draw background: */ - for (y = 0; y < 15; ++y) { for (x = 0; x < 21; ++x) @@ -549,30 +515,11 @@ current_level.ia_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); } } + + world.draw(); - /* (Bouncy bricks): */ - for (unsigned int i = 0; i < bouncy_bricks.size(); ++i) - bouncy_brick_draw(&bouncy_bricks[i]); - - for (unsigned int i = 0; i < bad_guys.size(); ++i) - bad_guys[i].draw(); - - tux.draw(); - - for (unsigned int i = 0; i < bullets.size(); ++i) - bullet_draw(&bullets[i]); - - for (unsigned int i = 0; i < floating_scores.size(); ++i) - floating_score_draw(&floating_scores[i]); - - for (unsigned int i = 0; i < upgrades.size(); ++i) - upgrade_draw(&upgrades[i]); - - for (unsigned int i = 0; i < bouncy_distros.size(); ++i) - bouncy_distro_draw(&bouncy_distros[i]); - - for (unsigned int i = 0; i < broken_bricks.size(); ++i) - broken_brick_draw(&broken_bricks[i]); + for (unsigned int i = 0; i < world.broken_bricks.size(); ++i) + broken_brick_draw(&world.broken_bricks[i]); /* Draw foreground: */ for (y = 0; y < 15; ++y) @@ -585,7 +532,7 @@ } /* Draw particle systems (foreground) */ - for(p = particle_systems.begin(); p != particle_systems.end(); ++p) + for(p = world.particle_systems.begin(); p != world.particle_systems.end(); ++p) { (*p)->draw(scroll_x, 0, 1); } @@ -799,7 +746,7 @@ current_level.cleanup(); level_free_song(); unloadshared(); - arrays_free(); + world.arrays_free(); game_started = false; @@ -1188,8 +1135,8 @@ /* Bounce a brick: */ void bumpbrick(float x, float y) { - add_bouncy_brick(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); + world.add_bouncy_brick(((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); } @@ -1345,7 +1292,7 @@ current_level.cleanup(); if(current_level.load(level_subset,level) != 0) exit(1); - arrays_free(); + world.arrays_free(); activate_bad_guys(¤t_level); activate_particle_systems(); level_free_gfx(); Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- player.cpp 10 Apr 2004 22:01:26 -0000 1.23 +++ player.cpp 10 Apr 2004 22:37:13 -0000 1.24 @@ -478,7 +478,7 @@ if (input.fire == DOWN && input.old_fire == UP && got_coffee) { - add_bullet(base.x, base.y, physic.get_velocity_x(), dir); + world.add_bullet(base.x, base.y, physic.get_velocity_x(), dir); } @@ -827,9 +827,9 @@ { pbad_c->dying = DYING_FALLING; play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); - add_score(pbad_c->base.x - scroll_x, - pbad_c->base.y, - 25 * score_multiplier); + world.add_score(pbad_c->base.x - scroll_x, + pbad_c->base.y, + 25 * score_multiplier); } } } Index: collision.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- collision.cpp 4 Apr 2004 00:32:10 -0000 1.10 +++ collision.cpp 10 Apr 2004 22:37:13 -0000 1.11 @@ -204,42 +204,42 @@ void collision_handler() { // CO_BULLET & CO_BADGUY check - for(unsigned int i = 0; i < bullets.size(); ++i) + for(unsigned int i = 0; i < world.bullets.size(); ++i) { - for(unsigned int j = 0; j < bad_guys.size(); ++j) + for(unsigned int j = 0; j < world.bad_guys.size(); ++j) { - if(bad_guys[j].dying != DYING_NOT) + if(world.bad_guys[j].dying != DYING_NOT) continue; - if(rectcollision(&bullets[i].base, &bad_guys[j].base)) + if(rectcollision(&world.bullets[i].base, &world.bad_guys[j].base)) { // We have detected a collision and now call the // collision functions of the collided objects. // collide with bad_guy first, since bullet_collision will // delete the bullet - bad_guys[j].collision(0, CO_BULLET); - bullet_collision(&bullets[i], CO_BADGUY); + world.bad_guys[j].collision(0, CO_BULLET); + bullet_collision(&world.bullets[i], CO_BADGUY); break; // bullet is invalid now, so break } } } /* CO_BADGUY & CO_BADGUY check */ - for(unsigned int i = 0; i < bad_guys.size(); ++i) + for(unsigned int i = 0; i < world.bad_guys.size(); ++i) { - if(bad_guys[i].dying != DYING_NOT) + if(world.bad_guys[i].dying != DYING_NOT) continue; - for(unsigned int j = i+1; j < bad_guys.size(); ++j) + for(unsigned int j = i+1; j < world.bad_guys.size(); ++j) { - if(j == i || bad_guys[j].dying != DYING_NOT) + if(j == i || world.bad_guys[j].dying != DYING_NOT) continue; - if(rectcollision(&bad_guys[i].base, &bad_guys[j].base)) + if(rectcollision(&world.bad_guys[i].base, &world.bad_guys[j].base)) { // We have detected a collision and now call the // collision functions of the collided objects. - bad_guys[j].collision(&bad_guys[i], CO_BADGUY); - bad_guys[i].collision(&bad_guys[j], CO_BADGUY); + world.bad_guys[j].collision(&world.bad_guys[i], CO_BADGUY); + world.bad_guys[i].collision(&world.bad_guys[j], CO_BADGUY); } } } @@ -247,35 +247,36 @@ if(tux.dying != DYING_NOT) return; // CO_BADGUY & CO_PLAYER check - for(unsigned int i = 0; i < bad_guys.size(); ++i) + for(unsigned int i = 0; i < world.bad_guys.size(); ++i) { - if(bad_guys[i].dying != DYING_NOT) + if(world.bad_guys[i].dying != DYING_NOT) continue; - if(rectcollision_offset(&bad_guys[i].base,&tux.base,0,0)) + if(rectcollision_offset(&world.bad_guys[i].base,&tux.base,0,0)) { // We have detected a collision and now call the collision // functions of the collided objects. if (tux.previous_base.y < tux.base.y && - tux.previous_base.y + tux.previous_base.height < bad_guys[i].base.y + bad_guys[i].base.height/2) + tux.previous_base.y + tux.previous_base.height + < world.bad_guys[i].base.y + world.bad_guys[i].base.height/2) { - bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_SQUISH); + world.bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_SQUISH); } else { - tux.collision(&bad_guys[i], CO_BADGUY); + tux.collision(&world.bad_guys[i], CO_BADGUY); } } } // CO_UPGRADE & CO_PLAYER check - for(unsigned int i = 0; i < upgrades.size(); ++i) + for(unsigned int i = 0; i < world.upgrades.size(); ++i) { - if(rectcollision(&upgrades[i].base,&tux.base)) + if(rectcollision(&world.upgrades[i].base, &tux.base)) { // We have detected a collision and now call the collision // functions of the collided objects. - upgrade_collision(&upgrades[i], &tux, CO_PLAYER); + upgrade_collision(&world.upgrades[i], &tux, CO_PLAYER); } } Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- leveleditor.cpp 10 Apr 2004 20:26:13 -0000 1.31 +++ leveleditor.cpp 10 Apr 2004 22:37:13 -0000 1.32 @@ -242,7 +242,7 @@ le_level_subset.load(level_subsets.item[i-2]); leveleditor_menu->item[3].kind = MN_GOTO; le_level = 1; - arrays_free(); + world.arrays_free(); loadshared(); le_current_level = new Level; if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) @@ -273,7 +273,7 @@ le_level_subset.load(subset_new_menu->item[2].input); leveleditor_menu->item[3].kind = MN_GOTO; le_level = 1; - arrays_free(); + world.arrays_free(); loadshared(); le_current_level = new Level; if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) @@ -542,7 +542,7 @@ void le_goto_level(int levelnb) { - arrays_free(); + world.arrays_free(); le_current_level->cleanup(); if(le_current_level->load(le_level_subset.name.c_str(), levelnb) != 0) @@ -596,7 +596,7 @@ level_free_gfx(); le_current_level->cleanup(); unloadshared(); - arrays_free(); + world.arrays_free(); } } @@ -725,12 +725,12 @@ } /* Draw the Bad guys: */ - for (i = 0; i < bad_guys.size(); ++i) + for (i = 0; i < world.bad_guys.size(); ++i) { /* to support frames: img_bsod_left[(frame / 5) % 4] */ scroll_x = pos_x; - bad_guys[i].draw(); + world.bad_guys[i].draw(); } @@ -1119,16 +1119,16 @@ xx = ((int)x / 32); /* if there is a bad guy over there, remove it */ - for(i = 0; i < bad_guys.size(); ++i) - if(xx == bad_guys[i].base.x/32 && yy == bad_guys[i].base.y/32) - bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&bad_guys[i])); + for(i = 0; i < world.bad_guys.size(); ++i) + if(xx == world.bad_guys[i].base.x/32 && yy == world.bad_guys[i].base.y/32) + world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&world.bad_guys[i])); if(c == '0') /* if it's a bad guy */ - add_bad_guy(xx*32, yy*32, BAD_BSOD); + world.add_bad_guy(xx*32, yy*32, BAD_BSOD); else if(c == '1') - add_bad_guy(xx*32, yy*32, BAD_LAPTOP); + world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP); else if(c == '2') - add_bad_guy(xx*32, yy*32, BAD_MONEY); + world.add_bad_guy(xx*32, yy*32, BAD_MONEY); break; case SQUARE: @@ -1159,10 +1159,10 @@ y2 /= 32; /* if there is a bad guy over there, remove it */ - for(i = 0; i < bad_guys.size(); ++i) - if(bad_guys[i].base.x/32 >= x1 && bad_guys[i].base.x/32 <= x2 - && bad_guys[i].base.y/32 >= y1 && bad_guys[i].base.y/32 <= y2) - bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&bad_guys[i])); + for(i = 0; i < world.bad_guys.size(); ++i) + if(world.bad_guys[i].base.x/32 >= x1 && world.bad_guys[i].base.x/32 <= x2 + && world.bad_guys[i].base.y/32 >= y1 && world.bad_guys[i].base.y/32 <= y2) + world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&world.bad_guys[i])); for(xx = x1; xx <= x2; xx++) for(yy = y1; yy <= y2; yy++) @@ -1170,11 +1170,11 @@ le_current_level->change(xx*32, yy*32, tm, c); if(c == '0') // if it's a bad guy - add_bad_guy(xx*32, yy*32, BAD_BSOD); + world.add_bad_guy(xx*32, yy*32, BAD_BSOD); else if(c == '1') - add_bad_guy(xx*32, yy*32, BAD_LAPTOP); + world.add_bad_guy(xx*32, yy*32, BAD_LAPTOP); else if(c == '2') - add_bad_guy(xx*32, yy*32, BAD_MONEY); + world.add_bad_guy(xx*32, yy*32, BAD_MONEY); } break; default: @@ -1191,7 +1191,7 @@ session.run(); Menu::set_current(leveleditor_menu); - arrays_free(); + world.arrays_free(); le_current_level->load_gfx(); loadshared(); activate_bad_guys(le_current_level); Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- gameloop.h 10 Apr 2004 22:01:26 -0000 1.28 +++ gameloop.h 10 Apr 2004 22:37:13 -0000 1.29 @@ -26,6 +26,9 @@ extern int game_started; +/** The GameSession class controlls the controll flow of a World, ie. + present the menu on specifc keypresses, render and update it while + keeping the speed and framerate sane, etc. */ class GameSession { private: Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- badguy.cpp 10 Apr 2004 11:42:43 -0000 1.21 +++ badguy.cpp 10 Apr 2004 22:37:13 -0000 1.22 @@ -372,13 +372,14 @@ void BadGuy::remove_me() { - std::vector<BadGuy>::iterator i; - for(i = bad_guys.begin(); i != bad_guys.end(); ++i) { - if( & (*i) == this) { - bad_guys.erase(i); - return; + for(std::vector<BadGuy>::iterator i = world.bad_guys.begin(); + i != world.bad_guys.end(); ++i) + { + if( & (*i) == this) { + world.bad_guys.erase(i); + return; + } } - } } void @@ -783,7 +784,7 @@ { make_player_jump(player); - add_score(base.x - scroll_x, base.y, 50 * score_multiplier); + world.add_score(base.x - scroll_x, base.y, 50 * score_multiplier); play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); score_multiplier++; @@ -796,58 +797,58 @@ BadGuy::squish(Player* player) { if(kind == BAD_MRBOMB) { - // mrbomb transforms into a bomb now - add_bad_guy(base.x, base.y, BAD_BOMB); - - make_player_jump(player); - add_score(base.x - scroll_x, base.y, 50 * score_multiplier); - play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); - score_multiplier++; + // mrbomb transforms into a bomb now + world.add_bad_guy(base.x, base.y, BAD_BOMB); + + make_player_jump(player); + world.add_score(base.x - scroll_x, base.y, 50 * score_multiplier); + play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); + score_multiplier++; - remove_me(); - return; + remove_me(); + return; } else if(kind == BAD_BSOD) { - squish_me(player); - set_texture(img_bsod_squished_left, img_bsod_squished_right, 1); - physic.set_velocity(0, physic.get_velocity_y()); - return; + squish_me(player); + set_texture(img_bsod_squished_left, img_bsod_squished_right, 1); + physic.set_velocity(0, physic.get_velocity_y()); + return; } else if (kind == BAD_LAPTOP) { - if (mode == NORMAL || mode == KICK) + if (mode == NORMAL || mode == KICK) { - /* Flatten! */ - play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); - mode = FLAT; - set_texture(img_laptop_flat_left, img_laptop_flat_right, 1); - physic.set_velocity(0, physic.get_velocity_y()); + /* Flatten! */ + play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); + mode = FLAT; + set_texture(img_laptop_flat_left, img_laptop_flat_right, 1); + physic.set_velocity(0, physic.get_velocity_y()); - timer_start(&timer, 4000); + timer_start(&timer, 4000); } else if (mode == FLAT) { - /* Kick! */ - play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); + /* Kick! */ + play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); - if (player->base.x < base.x + (base.width/2)) { - physic.set_velocity(5, physic.get_velocity_y()); - dir = RIGHT; - } else { - physic.set_velocity(-5, physic.get_velocity_y()); - dir = LEFT; - } + if (player->base.x < base.x + (base.width/2)) { + physic.set_velocity(5, physic.get_velocity_y()); + dir = RIGHT; + } else { + physic.set_velocity(-5, physic.get_velocity_y()); + dir = LEFT; + } - mode = KICK; - set_texture(img_laptop_flat_left, img_laptop_flat_right, 1); + mode = KICK; + set_texture(img_laptop_flat_left, img_laptop_flat_right, 1); } - make_player_jump(player); + make_player_jump(player); - add_score(base.x - scroll_x, base.y, 25 * score_multiplier); - score_multiplier++; - return; + world.add_score(base.x - scroll_x, base.y, 25 * score_multiplier); + score_multiplier++; + return; } else if(kind == BAD_FISH) { make_player_jump(player); - add_score(base.x - scroll_x, base.y, 25 * score_multiplier); + world.add_score(base.x - scroll_x, base.y, 25 * score_multiplier); score_multiplier++; // simply remove the fish... @@ -885,11 +886,11 @@ /* Gain some points: */ if (kind == BAD_BSOD) - add_score(base.x - scroll_x, base.y, - 50 * score_multiplier); + world.add_score(base.x - scroll_x, base.y, + 50 * score_multiplier); else - add_score(base.x - scroll_x, base.y, - 25 * score_multiplier); + world.add_score(base.x - scroll_x, base.y, + 25 * score_multiplier); /* Play death sound: */ play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- world.cpp 10 Apr 2004 22:01:27 -0000 1.6 +++ world.cpp 10 Apr 2004 22:37:13 -0000 1.7 @@ -21,6 +21,165 @@ texture_type img_distro[4]; +World world; + +World::World() +{ + +} + +void +World::arrays_free(void) +{ + bad_guys.clear(); + bouncy_distros.clear(); + broken_bricks.clear(); + bouncy_bricks.clear(); + floating_scores.clear(); + upgrades.clear(); + bullets.clear(); + std::vector<ParticleSystem*>::iterator i; + for(i = particle_systems.begin(); i != particle_systems.end(); ++i) { + delete *i; + } + particle_systems.clear(); +} + +void +World::draw() +{ + /* (Bouncy bricks): */ + for (unsigned int i = 0; i < bouncy_bricks.size(); ++i) + bouncy_brick_draw(&bouncy_bricks[i]); + + for (unsigned int i = 0; i < bad_guys.size(); ++i) + bad_guys[i].draw(); + + tux.draw(); + + for (unsigned int i = 0; i < bullets.size(); ++i) + bullet_draw(&bullets[i]); + + for (unsigned int i = 0; i < floating_scores.size(); ++i) + floating_score_draw(&floating_scores[i]); + + for (unsigned int i = 0; i < upgrades.size(); ++i) + upgrade_draw(&upgrades[i]); + + for (unsigned int i = 0; i < bouncy_distros.size(); ++i) + bouncy_distro_draw(&bouncy_distros[i]); +} + +void +World::action() +{ + /* Handle bouncy distros: */ + for (unsigned int i = 0; i < bouncy_distros.size(); i++) + bouncy_distro_action(&bouncy_distros[i]); + + /* Handle broken bricks: */ + for (unsigned int i = 0; i < broken_bricks.size(); i++) + broken_brick_action(&broken_bricks[i]); + + /* Handle distro counting: */ + if (counting_distros) + { + distro_counter--; + + if (distro_counter <= 0) + counting_distros = -1; + } + + // Handle all kinds of game objects + for (unsigned int i = 0; i < bouncy_bricks.size(); i++) + bouncy_brick_action(&bouncy_bricks[i]); + + for (unsigned int i = 0; i < floating_scores.size(); i++) + floating_score_action(&floating_scores[i]); + + for (unsigned int i = 0; i < bullets.size(); ++i) + bullet_action(&bullets[i]); + + for (unsigned int i = 0; i < upgrades.size(); i++) + upgrade_action(&upgrades[i]); + + for (unsigned int i = 0; i < bad_guys.size(); i++) + bad_guys[i].action(); +} + +void +World::add_score(float x, float y, int s) +{ + score += s; + + floating_score_type new_floating_score; + floating_score_init(&new_floating_score,x,y,s); + floating_scores.push_back(new_floating_score); +} + +void +World::add_bouncy_distro(float x, float y) +{ + bouncy_distro_type new_bouncy_distro; + bouncy_distro_init(&new_bouncy_distro,x,y); + bouncy_distros.push_back(new_bouncy_distro); +} + +void +World::add_broken_brick(float x, float y) +{ + add_broken_brick_piece(x, y, -1, -4); + add_broken_brick_piece(x, y + 16, -1.5, -3); + + add_broken_brick_piece(x + 16, y, 1, -4); + add_broken_brick_piece(x + 16, y + 16, 1.5, -3); +} + +void +World::add_broken_brick_piece(float x, float y, float xm, float ym) +{ + broken_brick_type new_broken_brick; + broken_brick_init(&new_broken_brick,x,y,xm,ym); + broken_bricks.push_back(new_broken_brick); +} + +void +World::add_bouncy_brick(float x, float y) +{ + bouncy_brick_type new_bouncy_brick; + bouncy_brick_init(&new_bouncy_brick,x,y); + bouncy_bricks.push_back(new_bouncy_brick); +} + +void +World::add_bad_guy(float x, float y, BadGuyKind kind) +{ + bad_guys.push_back(BadGuy()); + BadGuy& new_bad_guy = bad_guys.back(); + + new_bad_guy.init(x,y,kind); +} + +void +World::add_upgrade(float x, float y, int dir, int kind) +{ + upgrade_type new_upgrade; + upgrade_init(&new_upgrade,x,y,dir,kind); + upgrades.push_back(new_upgrade); +} + +void +World::add_bullet(float x, float y, float xm, int dir) +{ + bullet_type new_bullet; + bullet_init(&new_bullet,x,y,xm,dir); + bullets.push_back(new_bullet); + + play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER); +} + + + void bouncy_distro_init(bouncy_distro_type* pbouncy_distro, float x, float y) { pbouncy_distro->base.x = x; @@ -35,7 +194,7 @@ pbouncy_distro->base.ym += 0.1 * frame_ratio; if (pbouncy_distro->base.ym >= 0) - bouncy_distros.erase(static_cast<std::vector<bouncy_distro_type>::iterator>(pbouncy_distro)); + world.bouncy_distros.erase(static_cast<std::vector<bouncy_distro_type>::iterator>(pbouncy_distro)); } void bouncy_distro_draw(bouncy_distro_type* pbouncy_distro) @@ -61,7 +220,7 @@ pbroken_brick->base.y = pbroken_brick->base.y + pbroken_brick->base.ym * frame_ratio; if (!timer_check(&pbroken_brick->timer)) - broken_bricks.erase(static_cast<std::vector<broken_brick_type>::iterator>(pbroken_brick)); + world.broken_bricks.erase(static_cast<std::vector<broken_brick_type>::iterator>(pbroken_brick)); } void broken_brick_draw(broken_brick_type* pbroken_brick) @@ -104,7 +263,7 @@ /* Stop bouncing? */ if (pbouncy_brick->offset >= 0) - bouncy_bricks.erase(static_cast<std::vector<bouncy_brick_type>::iterator>(pbouncy_brick)); + world.bouncy_bricks.erase(static_cast<std::vector<bouncy_brick_type>::iterator>(pbouncy_brick)); } void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick) @@ -156,7 +315,7 @@ pfloating_score->base.y = pfloating_score->base.y - 2 * frame_ratio; if(!timer_check(&pfloating_score->timer)) - floating_scores.erase(static_cast<std::vector<floating_score_type>::iterator>(pfloating_score)); + world.floating_scores.erase(static_cast<std::vector<floating_score_type>::iterator>(pfloating_score)); } void floating_score_draw(floating_score_type* pfloating_score) @@ -177,8 +336,8 @@ if (tile->data > 0) { /* Get a distro from it: */ - add_bouncy_distro(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); + world.add_bouncy_distro(((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); if (!counting_distros) { @@ -199,7 +358,7 @@ plevel->change(x, y, TM_IA, tile->next_tile); /* Replace it with broken bits: */ - add_broken_brick(((int)(x + 1) / 32) * 32, + world.add_broken_brick(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32); /* Get some score: */ @@ -227,7 +386,7 @@ switch(tile->data) { case 1: //'A': /* Box with a distro! */ - add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32 - 32); + world.add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32 - 32); play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); score = score + SCORE_DISTRO; distros++; @@ -235,14 +394,14 @@ case 2: // 'B': /* Add an upgrade! */ if (tux.size == SMALL) /* Tux is small, add mints! */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_MINTS); + world.add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_MINTS); else /* Tux is big, add coffee: */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_COFFEE); + world.add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_COFFEE); play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); break; case 3:// '!': /* Add a golden herring */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_HERRING); + world.add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_HERRING); break; default: break; @@ -264,8 +423,8 @@ if (bounciness == BOUNCE) { - add_bouncy_distro(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); + world.add_bouncy_distro(((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); } score = score + SCORE_DISTRO; @@ -277,25 +436,25 @@ void trybumpbadguy(float x, float y) { /* Bad guys: */ - for (unsigned int i = 0; i < bad_guys.size(); i++) + for (unsigned int i = 0; i < world.bad_guys.size(); i++) { - if (bad_guys[i].base.x >= x - 32 && bad_guys[i].base.x <= x + 32 && - bad_guys[i].base.y >= y - 16 && bad_guys[i].base.y <= y + 16) + if (world.bad_guys[i].base.x >= x - 32 && world.bad_guys[i].base.x <= x + 32 && + world.bad_guys[i].base.y >= y - 16 && world.bad_guys[i].base.y <= y + 16) { - bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_BUMP); + world.bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_BUMP); } } /* Upgrades: */ - for (unsigned int i = 0; i < upgrades.size(); i++) + for (unsigned int i = 0; i < world.upgrades.size(); i++) { - if (upgrades[i].base.height == 32 && - upgrades[i].base.x >= x - 32 && upgrades[i].base.x <= x + 32 && - upgrades[i].base.y >= y - 16 && upgrades[i].base.y <= y + 16) + if (world.upgrades[i].base.height == 32 && + world.upgrades[i].base.x >= x - 32 && world.upgrades[i].base.x <= x + 32 && + world.upgrades[i].base.y >= y - 16 && world.upgrades[i].base.y <= y + 16) { - upgrades[i].base.xm = -upgrades[i].base.xm; - upgrades[i].base.ym = -8; + world.upgrades[i].base.xm = -world.upgrades[i].base.xm; + world.upgrades[i].base.ym = -8; play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER); } } |
From: Ricardo C. <rm...@us...> - 2004-04-10 22:17:41
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30329/data/images/shared Modified Files: stalactite-broken.png stalactite.png Log Message: New stalactites done by Settra Gaia, they fit very well with Ingo graphics. They are 32x48 (previous: 32x32), i have checked, and i think nothing will get broken, but please test that. also say if 48 of height is too much... Index: stalactite-broken.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/stalactite-broken.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvscvBZpw and /tmp/cvsMAXLcP differ Index: stalactite.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/stalactite.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsuZTObD and /tmp/cvsKuw12V differ |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29828 Modified Files: gameloop.cpp gameloop.h level.cpp level.h player.cpp setup.cpp special.cpp title.cpp world.cpp world.h Log Message: - moved lots of code around, made gameloop even more into a class Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- world.h 23 Mar 2004 17:25:15 -0000 1.8 +++ world.h 10 Apr 2004 22:01:27 -0000 1.9 @@ -69,5 +69,19 @@ void floating_score_action(floating_score_type* pfloating_score); void floating_score_draw(floating_score_type* pfloating_score); + +/** Try to grab the coin at the given coordinates */ +void trygrabdistro(float x, float y, int bounciness); + +/** Try to break the brick at the given coordinates */ +void trybreakbrick(float x, float y, bool small); + +/** Try to get the content out of a bonus box, thus emptying it */ +void tryemptybox(float x, float y, int col_side); + +/** Try to bumb a badguy that might we walking above Tux, thus shaking + the tile which the badguy is walking on an killing him this way */ +void trybumpbadguy(float x, float y); + #endif /*SUPERTUX_WORLD_H*/ Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- setup.cpp 10 Apr 2004 20:26:13 -0000 1.27 +++ setup.cpp 10 Apr 2004 22:01:26 -0000 1.28 @@ -453,7 +453,7 @@ { int slot = save_game_menu->check(); if (slot != -1) - savegame(slot - 1); + GameSession::current()->savegame(slot - 1); } bool process_load_game_menu() @@ -486,7 +486,8 @@ } else { - loadgame(slot - 1); + //loadgame(slot - 1); + puts("Warning: Loading games isn't supported at the moment"); } } st_pause_ticks_stop(); Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- gameloop.h 10 Apr 2004 20:37:36 -0000 1.27 +++ gameloop.h 10 Apr 2004 22:01:26 -0000 1.28 @@ -24,44 +24,44 @@ #define ST_GL_LOAD_GAME 2 #define ST_GL_LOAD_LEVEL_FILE 3 -// FIXME: Make this local to the gamesession -extern Level current_level; - extern int game_started; class GameSession { private: timer_type fps_timer, frame_timer; + Level current_level; public: - GameSession(const char * subset, int levelnb, int mode); + GameSession(); + GameSession(const std::string& filename); + GameSession(const std::string& subset, int levelnb, int mode); int run(); void draw(); int action(); + void process_events(); + + Level* get_level() { return ¤t_level; } + + void savegame(int slot); + void loadgame(int slot); + + static GameSession* current() { return current_; } + private: + static GameSession* current_; + + void levelintro(); + void start_timers(); + void activate_particle_systems(); }; void activate_bad_guys(Level* plevel); -void savegame(int slot); -void loadgame(int slot); + std::string slotinfo(int slot); bool rectcollision(base_type* one, base_type* two); void drawshape(float x, float y, unsigned int c, Uint8 alpha = 255); void bumpbrick(float x, float y); -/** Try to grab the coin at the given coordinates */ -void trygrabdistro(float x, float y, int bounciness); - -/** Try to break the brick at the given coordinates */ -void trybreakbrick(float x, float y, bool small); - -/** Try to get the content out of a bonus box, thus emptying it */ -void tryemptybox(float x, float y, int col_side); - -/** Try to bumb a badguy that might we walking above Tux, thus shaking - the tile which the badguy is walking on an killing him this way */ -void trybumpbadguy(float x, float y); - #endif /*SUPERTUX_GAMELOOP_H*/ Index: special.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- special.cpp 3 Apr 2004 13:31:14 -0000 1.6 +++ special.cpp 10 Apr 2004 22:01:27 -0000 1.7 @@ -52,28 +52,28 @@ void bullet_action(bullet_type* pbullet) { - pbullet->base.x = pbullet->base.x + pbullet->base.xm * frame_ratio; - pbullet->base.y = pbullet->base.y + pbullet->base.ym * frame_ratio; + pbullet->base.x = pbullet->base.x + pbullet->base.xm * frame_ratio; + pbullet->base.y = pbullet->base.y + pbullet->base.ym * frame_ratio; - collision_swept_object_map(&pbullet->old_base,&pbullet->base); + collision_swept_object_map(&pbullet->old_base,&pbullet->base); - if (issolid(pbullet->base.x, pbullet->base.y + 4) || issolid(pbullet->base.x, pbullet->base.y)) - { - pbullet->base.ym = -pbullet->base.ym; - pbullet->base.y = (int)(pbullet->base.y / 32) * 32; - } + if (issolid(pbullet->base.x, pbullet->base.y + 4) || issolid(pbullet->base.x, pbullet->base.y)) + { + pbullet->base.ym = -pbullet->base.ym; + pbullet->base.y = (int)(pbullet->base.y / 32) * 32; + } - pbullet->base.ym = pbullet->base.ym + GRAVITY; + pbullet->base.ym = pbullet->base.ym + GRAVITY; - if (pbullet->base.x < scroll_x || - pbullet->base.x > scroll_x + screen->w || - pbullet->base.y < 0 || - pbullet->base.y > screen->h || - issolid(pbullet->base.x + 4, pbullet->base.y + 2) || - issolid(pbullet->base.x, pbullet->base.y + 2)) - { - bullets.erase(static_cast<std::vector<bullet_type>::iterator>(pbullet)); - } + if (pbullet->base.x < scroll_x || + pbullet->base.x > scroll_x + screen->w || + pbullet->base.y < 0 || + pbullet->base.y > screen->h || + issolid(pbullet->base.x + 4, pbullet->base.y + 2) || + issolid(pbullet->base.x, pbullet->base.y + 2)) + { + bullets.erase(static_cast<std::vector<bullet_type>::iterator>(pbullet)); + } } @@ -92,10 +92,10 @@ if(c_object == CO_BADGUY) { std::vector<bullet_type>::iterator i; for(i = bullets.begin(); i != bullets.end(); ++i) { - if(& (*i) == pbullet) { - bullets.erase(i); - return; - } + if(& (*i) == pbullet) { + bullets.erase(i); + return; + } } } } @@ -120,105 +120,105 @@ { - if (pupgrade->base.height < 32) - { - /* Rise up! */ + if (pupgrade->base.height < 32) + { + /* Rise up! */ - pupgrade->base.height = pupgrade->base.height + 0.7 * frame_ratio; - if(pupgrade->base.height > 32) - pupgrade->base.height = 32; - } - else - { - /* Move around? */ + pupgrade->base.height = pupgrade->base.height + 0.7 * frame_ratio; + if(pupgrade->base.height > 32) + pupgrade->base.height = 32; + } + else + { + /* Move around? */ - if (pupgrade->kind == UPGRADE_MINTS || - pupgrade->kind == UPGRADE_HERRING) - { - pupgrade->base.x = pupgrade->base.x + pupgrade->base.xm * frame_ratio; - pupgrade->base.y = pupgrade->base.y + pupgrade->base.ym * frame_ratio; + if (pupgrade->kind == UPGRADE_MINTS || + pupgrade->kind == UPGRADE_HERRING) + { + pupgrade->base.x = pupgrade->base.x + pupgrade->base.xm * frame_ratio; + pupgrade->base.y = pupgrade->base.y + pupgrade->base.ym * frame_ratio; - collision_swept_object_map(&pupgrade->old_base,&pupgrade->base); + collision_swept_object_map(&pupgrade->old_base,&pupgrade->base); - /* Off the screen? Kill it! */ + /* Off the screen? Kill it! */ - if (pupgrade->base.x < scroll_x - pupgrade->base.width) - upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); - if (pupgrade->base.y > screen->h) - upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); + if (pupgrade->base.x < scroll_x - pupgrade->base.width) + upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); + if (pupgrade->base.y > screen->h) + upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade)); - if (issolid(pupgrade->base.x + 1, pupgrade->base.y + 32.) || - issolid(pupgrade->base.x + 31., pupgrade->base.y + 32.)) + if (issolid(pupgrade->base.x + 1, pupgrade->base.y + 32.) || + issolid(pupgrade->base.x + 31., pupgrade->base.y + 32.)) + { + if (pupgrade->base.ym > 0) { - if (pupgrade->base.ym > 0) + if (pupgrade->kind == UPGRADE_MINTS) { - if (pupgrade->kind == UPGRADE_MINTS) - { - pupgrade->base.ym = 0; - } - else if (pupgrade->kind == UPGRADE_HERRING) - { - pupgrade->base.ym = -8; - } - - pupgrade->base.y = (int)(pupgrade->base.y / 32) * 32; + pupgrade->base.ym = 0; + } + else if (pupgrade->kind == UPGRADE_HERRING) + { + pupgrade->base.ym = -8; } - } - else - pupgrade->base.ym = pupgrade->base.ym + GRAVITY * frame_ratio; - if (issolid(pupgrade->base.x - 1, (int) pupgrade->base.y)) - { - if(pupgrade->base.xm < 0) - pupgrade->base.xm = -pupgrade->base.xm; - } - else if (issolid(pupgrade->base.x + pupgrade->base.width, (int) pupgrade->base.y)) - { - if(pupgrade->base.xm > 0) - pupgrade->base.xm = -pupgrade->base.xm; + pupgrade->base.y = (int)(pupgrade->base.y / 32) * 32; } } + else + pupgrade->base.ym = pupgrade->base.ym + GRAVITY * frame_ratio; + if (issolid(pupgrade->base.x - 1, (int) pupgrade->base.y)) + { + if(pupgrade->base.xm < 0) + pupgrade->base.xm = -pupgrade->base.xm; + } + else if (issolid(pupgrade->base.x + pupgrade->base.width, (int) pupgrade->base.y)) + { + if(pupgrade->base.xm > 0) + pupgrade->base.xm = -pupgrade->base.xm; + } } + + } } void upgrade_draw(upgrade_type* pupgrade) { SDL_Rect dest; - if (pupgrade->base.height < 32) - { - /* Rising up... */ + if (pupgrade->base.height < 32) + { + /* Rising up... */ - dest.x = (int)(pupgrade->base.x - scroll_x); - dest.y = (int)(pupgrade->base.y + 32 - pupgrade->base.height); - dest.w = 32; - dest.h = (int)pupgrade->base.height; + dest.x = (int)(pupgrade->base.x - scroll_x); + dest.y = (int)(pupgrade->base.y + 32 - pupgrade->base.height); + dest.w = 32; + dest.h = (int)pupgrade->base.height; - if (pupgrade->kind == UPGRADE_MINTS) - texture_draw_part(&img_mints,0,0,dest.x,dest.y,dest.w,dest.h); - else if (pupgrade->kind == UPGRADE_COFFEE) - texture_draw_part(&img_coffee,0,0,dest.x,dest.y,dest.w,dest.h); - else if (pupgrade->kind == UPGRADE_HERRING) - texture_draw_part(&img_golden_herring,0,0,dest.x,dest.y,dest.w,dest.h); + if (pupgrade->kind == UPGRADE_MINTS) + texture_draw_part(&img_mints,0,0,dest.x,dest.y,dest.w,dest.h); + else if (pupgrade->kind == UPGRADE_COFFEE) + texture_draw_part(&img_coffee,0,0,dest.x,dest.y,dest.w,dest.h); + else if (pupgrade->kind == UPGRADE_HERRING) + texture_draw_part(&img_golden_herring,0,0,dest.x,dest.y,dest.w,dest.h); + } + else + { + if (pupgrade->kind == UPGRADE_MINTS) + { + texture_draw(&img_mints, + pupgrade->base.x - scroll_x, pupgrade->base.y); } - else + else if (pupgrade->kind == UPGRADE_COFFEE) { - if (pupgrade->kind == UPGRADE_MINTS) - { - texture_draw(&img_mints, - pupgrade->base.x - scroll_x, pupgrade->base.y); - } - else if (pupgrade->kind == UPGRADE_COFFEE) - { - texture_draw(&img_coffee, - pupgrade->base.x - scroll_x, pupgrade->base.y); - } - else if (pupgrade->kind == UPGRADE_HERRING) - { - texture_draw(&img_golden_herring, - pupgrade->base.x - scroll_x, pupgrade->base.y); - } + texture_draw(&img_coffee, + pupgrade->base.x - scroll_x, pupgrade->base.y); } + else if (pupgrade->kind == UPGRADE_HERRING) + { + texture_draw(&img_golden_herring, + pupgrade->base.x - scroll_x, pupgrade->base.y); + } + } } void upgrade_collision(upgrade_type* pupgrade, void* p_c_object, int c_object) @@ -244,11 +244,11 @@ pplayer->base.height = 64; pplayer->base.y -= 32; if(collision_object_map(&pplayer->base)) - { - pplayer->base.height = 32; - pplayer->base.y += 32; - pplayer->duck = true; - } + { + pplayer->base.height = 32; + pplayer->base.y += 32; + pplayer->duck = true; + } timer_start(&super_bkgd_timer, 350); } else if (pupgrade->kind == UPGRADE_COFFEE) Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- player.cpp 10 Apr 2004 19:40:48 -0000 1.22 +++ player.cpp 10 Apr 2004 22:01:26 -0000 1.23 @@ -914,6 +914,8 @@ void Player::keep_in_bounds() { + Level* plevel = GameSession::current()->get_level(); + /* Keep tux in bounds: */ if (base.x< 0) base.x= 0; @@ -928,14 +930,17 @@ scroll_x = 0; } - else if (base.x> screen->w / 2 + scroll_x && scroll_x < ((current_level.width * 32) - screen->w)) + else if (base.x > screen->w / 2 + scroll_x + && scroll_x < ((GameSession::current()->get_level()->width * 32) - screen->w)) { - // Scroll the screen in past center: + // FIXME: Scrolling needs to be handled by a seperate View + // class, doing it as a player huck is ugly + // Scroll the screen in past center: scroll_x = base.x - screen->w / 2; - if (scroll_x > ((current_level.width * 32) - screen->w)) - scroll_x = ((current_level.width * 32) - screen->w); + if (scroll_x > ((plevel->width * 32) - screen->w)) + scroll_x = ((plevel->width * 32) - screen->w); } else if (base.x> 608 + scroll_x) { Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- title.cpp 10 Apr 2004 19:49:49 -0000 1.26 +++ title.cpp 10 Apr 2004 22:01:27 -0000 1.27 @@ -40,7 +40,6 @@ #include "math.h" void loadshared(void); -void activate_particle_systems(void); static texture_type bkg_title; static texture_type logo; @@ -65,10 +64,10 @@ texture_draw_bg(&bkg_title); } -void draw_demo() +void draw_demo(Level* plevel) { - /* DEMO begin */ - /* update particle systems */ + /* FIXME: + // update particle systems std::vector<ParticleSystem*>::iterator p; for(p = particle_systems.begin(); p != particle_systems.end(); ++p) { @@ -80,6 +79,7 @@ { (*p)->draw(scroll_x, 0, 0); } + */ // Draw interactive tiles: for (int y = 0; y < 15; ++y) @@ -87,7 +87,7 @@ for (int x = 0; x < 21; ++x) { drawshape(32*x - fmodf(scroll_x, 32), y * 32, - current_level.ia_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); + plevel->ia_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); } } @@ -108,9 +108,9 @@ } // Wrap around at the end of the level back to the beginnig - if(current_level.width * 32 - 320 < titletux.base.x) + if(plevel->width * 32 - 320 < titletux.base.x) { - titletux.base.x = titletux.base.x - (current_level.width * 32 - 640); + titletux.base.x = titletux.base.x - (plevel->width * 32 - 640); scroll_x = titletux.base.x - 320; } @@ -142,9 +142,9 @@ st_pause_ticks_init(); - current_level.load((datadir + "/levels/misc/menu.stl").c_str()); + GameSession session(datadir + "/levels/misc/menu.stl"); loadshared(); - activate_particle_systems(); + //FIXME:activate_particle_systems(); /* Lower the gravity that tux doesn't jump to hectically through the demo */ //gravity = 5; @@ -215,8 +215,8 @@ /* Draw the background: */ draw_background(); - draw_demo(); - + draw_demo(session.get_level()); + if (current_menu == main_menu) texture_draw(&logo, 160, 30); Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- level.h 10 Apr 2004 20:16:15 -0000 1.19 +++ level.h 10 Apr 2004 22:01:26 -0000 1.20 @@ -82,7 +82,7 @@ void cleanup(); int load(const char* subset, int level); - int load(const char* filename); + int load(const std::string& filename); void load_gfx(); void load_song(); @@ -94,15 +94,15 @@ /** Resize the level to a new width */ void change_size (int new_width); + + /** Return the id of the tile at position x/y */ + unsigned int gettileid(float x, float y); }; void level_load_image(texture_type* ptexture, std::string theme, const char * file, int use_alpha); void level_free_song(); void level_free_gfx(); -/** Return the id of the tile at the given x/y coordinates */ -unsigned int gettileid(float x, float y); - /** Return a pointer to the tile at the given x/y coordinates */ Tile* gettile(float x, float y); Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- world.cpp 10 Apr 2004 19:40:49 -0000 1.5 +++ world.cpp 10 Apr 2004 22:01:27 -0000 1.6 @@ -17,6 +17,7 @@ #include "screen.h" #include "defines.h" #include "world.h" +#include "tile.h" texture_type img_distro[4]; @@ -81,11 +82,11 @@ void bouncy_brick_init(bouncy_brick_type* pbouncy_brick, float x, float y) { - pbouncy_brick->base.x = x; - pbouncy_brick->base.y = y; - pbouncy_brick->offset = 0; + pbouncy_brick->base.x = x; + pbouncy_brick->base.y = y; + pbouncy_brick->offset = 0; pbouncy_brick->offset_m = -BOUNCY_BRICK_SPEED; - pbouncy_brick->shape = gettileid(x, y); + pbouncy_brick->shape = GameSession::current()->get_level()->gettileid(x, y); } void bouncy_brick_action(bouncy_brick_type* pbouncy_brick) @@ -119,13 +120,15 @@ dest.w = 32; dest.h = 32; + Level* plevel = GameSession::current()->get_level(); + // FIXME: overdrawing hack to clean the tile from the screen to // paint it later at on offseted position - if(current_level.bkgd_image[0] == '\0') + if(plevel->bkgd_image[0] == '\0') { fillrect(pbouncy_brick->base.x - scroll_x, pbouncy_brick->base.y, - 32,32,current_level.bkgd_red,current_level.bkgd_green, - current_level.bkgd_blue,0); + 32,32, + plevel->bkgd_red, plevel->bkgd_green, plevel->bkgd_blue, 0); } else { @@ -163,5 +166,140 @@ text_draw(&gold_text, str, (int)pfloating_score->base.x + 16 - strlen(str) * 8, (int)pfloating_score->base.y, 1); } +/* Break a brick: */ +void trybreakbrick(float x, float y, bool small) +{ + Level* plevel = GameSession::current()->get_level(); + + Tile* tile = gettile(x, y); + if (tile->brick) + { + if (tile->data > 0) + { + /* Get a distro from it: */ + add_bouncy_distro(((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); + + if (!counting_distros) + { + counting_distros = true; + distro_counter = 50; + } + + if (distro_counter <= 0) + plevel->change(x, y, TM_IA, tile->next_tile); + + play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); + score = score + SCORE_DISTRO; + distros++; + } + else if (!small) + { + /* Get rid of it: */ + plevel->change(x, y, TM_IA, tile->next_tile); + + /* Replace it with broken bits: */ + add_broken_brick(((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); + + /* Get some score: */ + play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); + score = score + SCORE_BRICK; + } + } +} + +/* Empty a box: */ +void tryemptybox(float x, float y, int col_side) +{ + Level* plevel = GameSession::current()->get_level(); + + Tile* tile = gettile(x,y); + if (!tile->fullbox) + return; + + // according to the collision side, set the upgrade direction + if(col_side == LEFT) + col_side = RIGHT; + else + col_side = LEFT; + + switch(tile->data) + { + case 1: //'A': /* Box with a distro! */ + add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32 - 32); + play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); + score = score + SCORE_DISTRO; + distros++; + break; + + case 2: // 'B': /* Add an upgrade! */ + if (tux.size == SMALL) /* Tux is small, add mints! */ + add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_MINTS); + else /* Tux is big, add coffee: */ + add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_COFFEE); + play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); + break; + + case 3:// '!': /* Add a golden herring */ + add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_HERRING); + break; + default: + break; + } + + /* Empty the box: */ + plevel->change(x, y, TM_IA, tile->next_tile); +} + +/* Try to grab a distro: */ +void trygrabdistro(float x, float y, int bounciness) +{ + Level* plevel = GameSession::current()->get_level(); + Tile* tile = gettile(x, y); + if (tile && tile->distro) + { + plevel->change(x, y, TM_IA, tile->next_tile); + play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); + + if (bounciness == BOUNCE) + { + add_bouncy_distro(((int)(x + 1) / 32) * 32, + (int)(y / 32) * 32); + } + + score = score + SCORE_DISTRO; + distros++; + } +} + +/* Try to bump a bad guy from below: */ +void trybumpbadguy(float x, float y) +{ + /* Bad guys: */ + for (unsigned int i = 0; i < bad_guys.size(); i++) + { + if (bad_guys[i].base.x >= x - 32 && bad_guys[i].base.x <= x + 32 && + bad_guys[i].base.y >= y - 16 && bad_guys[i].base.y <= y + 16) + { + bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_BUMP); + } + } + + + /* Upgrades: */ + for (unsigned int i = 0; i < upgrades.size(); i++) + { + if (upgrades[i].base.height == 32 && + upgrades[i].base.x >= x - 32 && upgrades[i].base.x <= x + 32 && + upgrades[i].base.y >= y - 16 && upgrades[i].base.y <= y + 16) + { + upgrades[i].base.xm = -upgrades[i].base.xm; + upgrades[i].base.ym = -8; + play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER); + } + } +} + /* EOF */ Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- level.cpp 10 Apr 2004 20:16:15 -0000 1.25 +++ level.cpp 10 Apr 2004 22:01:26 -0000 1.26 @@ -245,14 +245,14 @@ } int -Level::load(const char* filename) +Level::load(const std::string& filename) { FILE * fi; lisp_object_t* root_obj = 0; - fi = fopen(filename, "r"); + fi = fopen(filename.c_str(), "r"); if (fi == NULL) { - perror(filename); + perror(filename.c_str()); return -1; } @@ -262,7 +262,7 @@ if (root_obj->type == LISP_TYPE_EOF || root_obj->type == LISP_TYPE_PARSE_ERROR) { - printf("World: Parse Error in file %s", filename); + printf("World: Parse Error in file %s", filename.c_str()); } vector<int> ia_tm; @@ -691,7 +691,8 @@ } -unsigned int gettileid(float x, float y) +unsigned int +Level::gettileid(float x, float y) { int xx, yy; unsigned int c; @@ -699,8 +700,8 @@ yy = ((int)y / 32); xx = ((int)x / 32); - if (yy >= 0 && yy < 15 && xx >= 0 && xx <= current_level.width) - c = current_level.ia_tiles[yy][xx]; + if (yy >= 0 && yy < 15 && xx >= 0 && xx <= width) + c = ia_tiles[yy][xx]; else c = 0; @@ -709,36 +710,36 @@ Tile* gettile(float x, float y) { - return TileManager::instance()->get(gettileid(x, y)); + return TileManager::instance()->get(GameSession::current()->get_level()->gettileid(x, y)); } bool issolid(float x, float y) { - Tile* tile = TileManager::instance()->get(gettileid(x,y)); + Tile* tile = gettile(x,y); return tile && tile->solid; } bool isbrick(float x, float y) { - Tile* tile = TileManager::instance()->get(gettileid(x,y)); + Tile* tile = gettile(x,y); return tile && tile->brick; } bool isice(float x, float y) { - Tile* tile = TileManager::instance()->get(gettileid(x,y)); + Tile* tile = gettile(x,y); return tile && tile->ice; } bool isfullbox(float x, float y) { - Tile* tile = TileManager::instance()->get(gettileid(x,y)); + Tile* tile = gettile(x,y); return tile && tile->fullbox; } bool isdistro(float x, float y) { - Tile* tile = TileManager::instance()->get(gettileid(x,y)); + Tile* tile = gettile(x,y); return tile && tile->distro; } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- gameloop.cpp 10 Apr 2004 20:37:36 -0000 1.48 +++ gameloop.cpp 10 Apr 2004 22:01:26 -0000 1.49 @@ -10,6 +10,7 @@ April 11, 2000 - March 15, 2004 */ +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <math.h> @@ -44,7 +45,6 @@ /* extern variables */ -Level current_level; int game_started = false; /* Local variables: */ @@ -61,8 +61,9 @@ static int pause_menu_frame; static int debug_fps; -/* Local function prototypes: */ +GameSession* GameSession::current_ = 0; +/* Local function prototypes: */ void levelintro(void); void loadshared(void); void unloadshared(void); @@ -70,7 +71,74 @@ void drawendscreen(void); void drawresultscreen(void); -void levelintro(void) +GameSession::GameSession() +{ + current_ = this; + assert(0); +} + +GameSession::GameSession(const std::string& filename) +{ + current_ = this; + + timer_init(&fps_timer, true); + timer_init(&frame_timer, true); + + current_level.load(filename); +} + +GameSession::GameSession(const std::string& subset, int levelnb, int mode) +{ + current_ = this; + + timer_init(&fps_timer, true); + timer_init(&frame_timer, true); + + game_started = true; + + st_gl_mode = mode; + level = levelnb; + + /* Init the game: */ + arrays_free(); + set_defaults(); + + strcpy(level_subset, subset.c_str()); + + if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) + { + if (current_level.load(level_subset)) + exit(1); + } + else + { + if(current_level.load(level_subset, level) != 0) + exit(1); + } + + current_level.load_gfx(); + loadshared(); + activate_bad_guys(¤t_level); + activate_particle_systems(); + current_level.load_song(); + + tux.init(); + + if(st_gl_mode != ST_GL_TEST) + load_hs(); + + if(st_gl_mode == ST_GL_PLAY || st_gl_mode == ST_GL_LOAD_LEVEL_FILE) + levelintro(); + + timer_init(&time_left,true); + start_timers(); + + if(st_gl_mode == ST_GL_LOAD_GAME) + loadgame(levelnb); +} + +void +GameSession::levelintro(void) { char str[60]; /* Level Intro: */ @@ -92,7 +160,8 @@ } /* Reset Timers */ -void start_timers(void) +void +GameSession::start_timers() { timer_start(&time_left,current_level.time_left*1000); st_pause_ticks_init(); @@ -109,7 +178,8 @@ } } -void activate_particle_systems(void) +void +GameSession::activate_particle_systems() { if(current_level.particle_system == "clouds") { @@ -125,9 +195,8 @@ } } -/* --- GAME EVENT! --- */ - -void game_event(void) +void +GameSession::process_events() { while (SDL_PollEvent(&event)) { @@ -294,14 +363,9 @@ } /* while */ } -/* --- GAME ACTION! --- */ - int GameSession::action() { - unsigned int i; - - /* (tux.is_dead() || next_level) */ if (tux.is_dead() || next_level) { /* Tux either died, or reached the end of a level! */ @@ -388,21 +452,14 @@ tux.action(); /* Handle bouncy distros: */ - for (i = 0; i < bouncy_distros.size(); i++) - { - bouncy_distro_action(&bouncy_distros[i]); - } - + for (unsigned int i = 0; i < bouncy_distros.size(); i++) + bouncy_distro_action(&bouncy_distros[i]); /* Handle broken bricks: */ - for (i = 0; i < broken_bricks.size(); i++) - { + for (unsigned int i = 0; i < broken_bricks.size(); i++) broken_brick_action(&broken_bricks[i]); - } - /* Handle distro counting: */ - if (counting_distros) { distro_counter--; @@ -411,44 +468,21 @@ counting_distros = -1; } + // Handle all kinds of game objects + for (unsigned int i = 0; i < bouncy_bricks.size(); i++) + bouncy_brick_action(&bouncy_bricks[i]); + + for (unsigned int i = 0; i < floating_scores.size(); i++) + floating_score_action(&floating_scores[i]); - /* Handle bouncy bricks: */ - - for (i = 0; i < bouncy_bricks.size(); i++) - { - bouncy_brick_action(&bouncy_bricks[i]); - } - - - /* Handle floating scores: */ - - for (i = 0; i < floating_scores.size(); i++) - { - floating_score_action(&floating_scores[i]); - } - - - /* Handle bullets: */ - - for (i = 0; i < bullets.size(); ++i) - { - bullet_action(&bullets[i]); - } - - /* Handle upgrades: */ - - for (i = 0; i < upgrades.size(); i++) - { - upgrade_action(&upgrades[i]); - } - - - /* Handle bad guys: */ + for (unsigned int i = 0; i < bullets.size(); ++i) + bullet_action(&bullets[i]); + + for (unsigned int i = 0; i < upgrades.size(); i++) + upgrade_action(&upgrades[i]); - for (i = 0; i < bad_guys.size(); i++) - { - bad_guys[i].action(); - } + for (unsigned int i = 0; i < bad_guys.size(); i++) + bad_guys[i].action(); /* update particle systems */ std::vector<ParticleSystem*>::iterator p; @@ -579,59 +613,12 @@ updatescreen(); } -/* --- GAME LOOP! --- */ - -GameSession::GameSession(const char * subset, int levelnb, int mode) -{ - timer_init(&fps_timer, true); - timer_init(&frame_timer, true); - - game_started = true; - - st_gl_mode = mode; - level = levelnb; - - /* Init the game: */ - arrays_free(); - set_defaults(); - - strcpy(level_subset,subset); - - if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) - { - if (current_level.load(level_subset)) - exit(1); - } - else - { - if(current_level.load(level_subset, level) != 0) - exit(1); - } - - current_level.load_gfx(); - loadshared(); - activate_bad_guys(¤t_level); - activate_particle_systems(); - current_level.load_song(); - - tux.init(); - - if(st_gl_mode != ST_GL_TEST) - load_hs(); - - if(st_gl_mode == ST_GL_PLAY || st_gl_mode == ST_GL_LOAD_LEVEL_FILE) - levelintro(); - - timer_init(&time_left,true); - start_timers(); - - if(st_gl_mode == ST_GL_LOAD_GAME) - loadgame(levelnb); -} int GameSession::run() { + current_ = this; + int fps_cnt; bool jump; bool done; @@ -677,7 +664,7 @@ tux.input.old_fire = tux.input.fire; - game_event(); + process_events(); if(show_menu) { @@ -1198,50 +1185,7 @@ } } -/* Break a brick: */ -void trybreakbrick(float x, float y, bool small) -{ - Tile* tile = gettile(x, y); - if (tile->brick) - { - if (tile->data > 0) - { - /* Get a distro from it: */ - add_bouncy_distro(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); - - if (!counting_distros) - { - counting_distros = true; - distro_counter = 50; - } - - if (distro_counter <= 0) - current_level.change(x, y, TM_IA, tile->next_tile); - - play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); - score = score + SCORE_DISTRO; - distros++; - } - else if (!small) - { - /* Get rid of it: */ - current_level.change(x, y, TM_IA, tile->next_tile); - - /* Replace it with broken bits: */ - add_broken_brick(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); - - /* Get some score: */ - play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); - score = score + SCORE_BRICK; - } - } -} - - /* Bounce a brick: */ - void bumpbrick(float x, float y) { add_bouncy_brick(((int)(x + 1) / 32) * 32, @@ -1250,95 +1194,6 @@ play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); } -/* Empty a box: */ -void tryemptybox(float x, float y, int col_side) -{ - Tile* tile = gettile(x,y); - if (!tile->fullbox) - return; - - // according to the collision side, set the upgrade direction - if(col_side == LEFT) - col_side = RIGHT; - else - col_side = LEFT; - - switch(tile->data) - { - case 1: //'A': /* Box with a distro! */ - add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32 - 32); - play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); - score = score + SCORE_DISTRO; - distros++; - break; - - case 2: // 'B': /* Add an upgrade! */ - if (tux.size == SMALL) /* Tux is small, add mints! */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_MINTS); - else /* Tux is big, add coffee: */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_COFFEE); - play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); - break; - - case 3:// '!': /* Add a golden herring */ - add_upgrade((int)((x + 1) / 32) * 32, (int)(y / 32) * 32 - 32, col_side, UPGRADE_HERRING); - break; - default: - break; - } - - /* Empty the box: */ - current_level.change(x, y, TM_IA, tile->next_tile); -} - -/* Try to grab a distro: */ -void trygrabdistro(float x, float y, int bounciness) -{ - Tile* tile = gettile(x, y); - if (tile && tile->distro) - { - current_level.change(x, y, TM_IA, tile->next_tile); - play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); - - if (bounciness == BOUNCE) - { - add_bouncy_distro(((int)(x + 1) / 32) * 32, - (int)(y / 32) * 32); - } - - score = score + SCORE_DISTRO; - distros++; - } -} - -/* Try to bump a bad guy from below: */ -void trybumpbadguy(float x, float y) -{ - /* Bad guys: */ - for (unsigned int i = 0; i < bad_guys.size(); i++) - { - if (bad_guys[i].base.x >= x - 32 && bad_guys[i].base.x <= x + 32 && - bad_guys[i].base.y >= y - 16 && bad_guys[i].base.y <= y + 16) - { - bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_BUMP); - } - } - - - /* Upgrades: */ - for (unsigned int i = 0; i < upgrades.size(); i++) - { - if (upgrades[i].base.height == 32 && - upgrades[i].base.x >= x - 32 && upgrades[i].base.x <= x + 32 && - upgrades[i].base.y >= y - 16 && upgrades[i].base.y <= y + 16) - { - upgrades[i].base.xm = -upgrades[i].base.xm; - upgrades[i].base.ym = -8; - play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER); - } - } -} - /* (Status): */ void drawstatus(void) { @@ -1426,7 +1281,8 @@ wait_for_event(event,2000,5000,true); } -void savegame(int slot) +void +GameSession::savegame(int slot) { char savefile[1024]; FILE* fi; @@ -1461,7 +1317,8 @@ } -void loadgame(int slot) +void +GameSession::loadgame(int slot) { char savefile[1024]; char str[100]; @@ -1498,10 +1355,10 @@ levelintro(); update_time = st_get_ticks(); - fread(&score,sizeof(int),1,fi); - fread(&distros,sizeof(int),1,fi); + fread(&score, sizeof(int),1,fi); + fread(&distros, sizeof(int),1,fi); fread(&scroll_x,sizeof(float),1,fi); - fread(&tux, sizeof(Player), 1, fi); + fread(&tux, sizeof(Player), 1, fi); timer_fread(&tux.invincible_timer,fi); timer_fread(&tux.skidding_timer,fi); timer_fread(&tux.safe_timer,fi); |
From: Ricardo C. <rm...@us...> - 2004-04-10 21:33:43
|
Update of /cvsroot/super-tux/supertux/data/levels/wansti In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22489/data/levels/wansti Log Message: Directory /cvsroot/super-tux/supertux/data/levels/wansti added to the repository |
From: Ingo R. <gr...@us...> - 2004-04-10 20:51:09
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15666 Modified Files: gameloop.cpp gameloop.h menu.cpp Log Message: - reduced menu fadness a bit (ie. balanced the edges) Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- menu.cpp 10 Apr 2004 18:56:17 -0000 1.26 +++ menu.cpp 10 Apr 2004 20:37:36 -0000 1.27 @@ -481,7 +481,7 @@ } } - return (menu_width * 16 + 48); + return (menu_width * 16 + 24); } int Menu::height() @@ -498,9 +498,9 @@ /* Draw a transparent background */ fillrect(pos_x - menu_width/2, - pos_y - 24*num_items/2, - menu_width,menu_height, - 150,180,200,100); + pos_y - 24*num_items/2 - 10, + menu_width,menu_height + 20, + 150,180,200,125); for(int i = 0; i < num_items; ++i) { Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- gameloop.h 10 Apr 2004 20:26:13 -0000 1.26 +++ gameloop.h 10 Apr 2004 20:37:36 -0000 1.27 @@ -32,10 +32,13 @@ class GameSession { private: - timer_type fps_timer, frame_timer; + timer_type fps_timer, frame_timer; + public: GameSession(const char * subset, int levelnb, int mode); - int run(); + int run(); + void draw(); + int action(); }; void activate_bad_guys(Level* plevel); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- gameloop.cpp 10 Apr 2004 20:26:13 -0000 1.47 +++ gameloop.cpp 10 Apr 2004 20:37:36 -0000 1.48 @@ -296,7 +296,8 @@ /* --- GAME ACTION! --- */ -int game_action(void) +int +GameSession::action() { unsigned int i; @@ -464,7 +465,8 @@ /* --- GAME DRAW! --- */ -void game_draw(void) +void +GameSession::draw() { int y,x; @@ -655,7 +657,7 @@ while (SDL_PollEvent(&event)) {} - game_draw(); + draw(); do { jump = false; @@ -721,7 +723,7 @@ frame_ratio = 1; while(z >= 1) {*/ - if (game_action() == 0) + if (action() == 0) { /* == 0: no more lives */ /* == -1: continues */ @@ -747,7 +749,7 @@ game_draw(); else jump = true;*/ /*FIXME: Implement this tweak right.*/ - game_draw(); + draw(); /* Time stops in pause mode */ if(game_pause || show_menu ) @@ -817,10 +819,8 @@ return(quit); } - /* Load graphics/sounds shared between all levels: */ - -void loadshared(void) +void loadshared() { int i; |
From: Ingo R. <gr...@us...> - 2004-04-10 20:40:04
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13726 Modified Files: gameloop.cpp gameloop.h leveleditor.cpp setup.cpp supertux.cpp worldmap.cpp Log Message: - turned gameloop into a class, in the hope to reduce some global variables in the long run Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- setup.cpp 10 Apr 2004 19:40:49 -0000 1.26 +++ setup.cpp 10 Apr 2004 20:26:13 -0000 1.27 @@ -468,7 +468,9 @@ if (tmp.length() == strlen("Slot X - Free")) { // Slot is free, so start a new game - gameloop("default", 1, ST_GL_PLAY); + GameSession session("default", 1, ST_GL_PLAY); + session.run(); + show_menu = true; Menu::set_current(main_menu); } @@ -476,7 +478,9 @@ { // Slot contains a level, so load it if (game_started) { - gameloop("default",slot - 1,ST_GL_LOAD_GAME); + GameSession session("default",slot - 1,ST_GL_LOAD_GAME); + session.run(); + show_menu = true; Menu::set_current(main_menu); } Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- leveleditor.cpp 10 Apr 2004 20:16:15 -0000 1.30 +++ leveleditor.cpp 10 Apr 2004 20:26:13 -0000 1.31 @@ -1186,7 +1186,10 @@ void le_testlevel() { le_current_level->save("test", le_level); - gameloop("test",le_level, ST_GL_TEST); + + GameSession session("test",le_level, ST_GL_TEST); + session.run(); + Menu::set_current(leveleditor_menu); arrays_free(); le_current_level->load_gfx(); Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- gameloop.h 10 Apr 2004 20:16:15 -0000 1.25 +++ gameloop.h 10 Apr 2004 20:26:13 -0000 1.26 @@ -29,11 +29,16 @@ extern int game_started; -/* Function prototypes: */ -class Tile; +class GameSession +{ + private: + timer_type fps_timer, frame_timer; + public: + GameSession(const char * subset, int levelnb, int mode); + int run(); +}; void activate_bad_guys(Level* plevel); -int gameloop(const char * subset, int levelnb, int mode); void savegame(int slot); void loadgame(int slot); std::string slotinfo(int slot); Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- worldmap.cpp 10 Apr 2004 18:56:17 -0000 1.19 +++ worldmap.cpp 10 Apr 2004 20:26:13 -0000 1.20 @@ -417,8 +417,9 @@ { std::cout << "Enter the current level: " << i->name << std::endl;; halt_music(); - gameloop(const_cast<char*>((datadir + "levels/default/" + i->name).c_str()), - 1, ST_GL_LOAD_LEVEL_FILE); + GameSession session(const_cast<char*>((datadir + "levels/default/" + i->name).c_str()), + 1, ST_GL_LOAD_LEVEL_FILE); + session.run(); play_music(song, 1); return; } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- gameloop.cpp 10 Apr 2004 20:16:15 -0000 1.46 +++ gameloop.cpp 10 Apr 2004 20:26:13 -0000 1.47 @@ -579,10 +579,8 @@ /* --- GAME LOOP! --- */ -int gameloop(const char * subset, int levelnb, int mode) +GameSession::GameSession(const char * subset, int levelnb, int mode) { - int fps_cnt, jump, done; - timer_type fps_timer, frame_timer; timer_init(&fps_timer, true); timer_init(&frame_timer, true); @@ -627,11 +625,18 @@ if(st_gl_mode == ST_GL_LOAD_GAME) loadgame(levelnb); +} - /* --- MAIN GAME LOOP!!! --- */ +int +GameSession::run() +{ + int fps_cnt; + bool jump; + bool done; + /* --- MAIN GAME LOOP!!! --- */ jump = false; - done = 0; + done = false; quit = 0; global_frame_counter = 0; game_pause = 0; @@ -641,14 +646,12 @@ fps_cnt = 0; /* Clear screen: */ - clearscreen(0, 0, 0); updatescreen(); /* Play music: */ play_current_music(); - while (SDL_PollEvent(&event)) {} @@ -691,7 +694,7 @@ break; case 7: st_pause_ticks_stop(); - done = 1; + done = true; break; } } Index: supertux.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/supertux.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- supertux.cpp 9 Apr 2004 00:49:47 -0000 1.5 +++ supertux.cpp 10 Apr 2004 20:26:13 -0000 1.6 @@ -34,7 +34,8 @@ } else if (level_startup_file) { - gameloop(level_startup_file, 1, ST_GL_LOAD_LEVEL_FILE); + GameSession session(level_startup_file, 1, ST_GL_LOAD_LEVEL_FILE); + session.run(); } else { |
From: Ricardo C. <rm...@us...> - 2004-04-10 20:33:05
|
Update of /cvsroot/super-tux/supertux/data/images/background In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12821/data/images/background Added Files: ocean.png Log Message: Another background image by a guy whose nickname is Wantso (i think) :D Anyway, it is a night background, might be usefull. --- NEW FILE: ocean.png --- (This appears to be a binary file; contents omitted.) |
From: Ingo R. <gr...@us...> - 2004-04-10 20:29:47
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12262 Modified Files: gameloop.cpp gameloop.h level.cpp level.h leveleditor.cpp physic.cpp Log Message: - more c++-ification Index: physic.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/physic.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- physic.cpp 4 Apr 2004 00:32:10 -0000 1.4 +++ physic.cpp 10 Apr 2004 20:16:15 -0000 1.5 @@ -75,7 +75,7 @@ void Physic::enable_gravity(bool enable_gravity) { - gravity_enabled = enable_gravity; + gravity_enabled = enable_gravity; } void Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- level.h 10 Apr 2004 19:49:49 -0000 1.18 +++ level.h 10 Apr 2004 20:16:15 -0000 1.19 @@ -55,7 +55,7 @@ extern texture_type img_solid[4]; extern texture_type img_brick[2]; -class st_level +class Level { public: std::string name; @@ -81,19 +81,24 @@ /** Cleanup the level struct from allocated tile data and such */ void cleanup(); - int load(const char * subset, int level); + int load(const char* subset, int level); int load(const char* filename); - + + void load_gfx(); + void load_song(); + + void save(const char* subset, int level); + + /** Edit a piece of the map! */ + void change(float x, float y, int tm, unsigned int c); + + /** Resize the level to a new width */ + void change_size (int new_width); }; -void level_save (st_level* plevel, const char * subset, int level); -void level_load_gfx (st_level* plevel); -void level_change (st_level* plevel, float x, float y, int tm, unsigned int c); -void level_change_size (st_level* plevel, int new_width); -void level_load_song(st_level* plevel); -void level_free_gfx(); void level_load_image(texture_type* ptexture, std::string theme, const char * file, int use_alpha); -void level_free_song(void); +void level_free_song(); +void level_free_gfx(); /** Return the id of the tile at the given x/y coordinates */ unsigned int gettileid(float x, float y); Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- gameloop.h 10 Apr 2004 19:40:48 -0000 1.24 +++ gameloop.h 10 Apr 2004 20:16:15 -0000 1.25 @@ -25,14 +25,14 @@ #define ST_GL_LOAD_LEVEL_FILE 3 // FIXME: Make this local to the gamesession -extern st_level current_level; +extern Level current_level; extern int game_started; /* Function prototypes: */ class Tile; -void activate_bad_guys(st_level* plevel); +void activate_bad_guys(Level* plevel); int gameloop(const char * subset, int levelnb, int mode); void savegame(int slot); void loadgame(int slot); Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- level.cpp 10 Apr 2004 19:49:49 -0000 1.24 +++ level.cpp 10 Apr 2004 20:16:15 -0000 1.25 @@ -35,14 +35,14 @@ void st_subset::create(const std::string& subset_name) { - st_level new_lev; + Level new_lev; st_subset new_subset; new_subset.name = subset_name; new_subset.title = "Unknown Title"; new_subset.description = "No description so far."; new_subset.save(); new_lev.init_defaults(); - level_save(&new_lev,subset_name.c_str(),1); + new_lev.save(subset_name.c_str(),1); } void st_subset::parse (lisp_object_t* cursor) @@ -193,7 +193,7 @@ } void -st_level::init_defaults() +Level::init_defaults() { name = "UnNamed"; theme = "antarctica"; @@ -231,7 +231,7 @@ /* Load data for this level: */ /* Returns -1, if the loading of the level failed. */ int -st_level::load(const char *subset, int level) +Level::load(const char *subset, int level) { char filename[1024]; @@ -245,7 +245,7 @@ } int -st_level::load(const char* filename) +Level::load(const char* filename) { FILE * fi; lisp_object_t* root_obj = 0; @@ -442,11 +442,10 @@ /* Save data for level: */ -void level_save(st_level* plevel,const char * subset, int level) +void +Level::save(const char * subset, int level) { - FILE * fi; char filename[1024]; - int y,i; char str[80]; /* Save data file: */ @@ -456,7 +455,7 @@ if(!fwriteable(filename)) snprintf(filename, 1024, "%s/levels/%s/level%d.stl", datadir.c_str(), subset, level); - fi = fopen(filename, "w"); + FILE * fi = fopen(filename, "w"); if (fi == NULL) { perror(filename); @@ -470,49 +469,48 @@ fprintf(fi,"(supertux-level\n"); fprintf(fi," (version %d)\n", 1); - fprintf(fi," (name \"%s\")\n", plevel->name.c_str()); - fprintf(fi," (theme \"%s\")\n", plevel->theme.c_str()); - fprintf(fi," (music \"%s\")\n", plevel->song_title.c_str()); - fprintf(fi," (background \"%s\")\n", plevel->bkgd_image.c_str()); - fprintf(fi," (particle_system \"%s\")\n", plevel->particle_system.c_str()); - fprintf(fi," (bkgd_red %d)\n", plevel->bkgd_red); - fprintf(fi," (bkgd_green %d)\n", plevel->bkgd_green); - fprintf(fi," (bkgd_blue %d)\n", plevel->bkgd_blue); - fprintf(fi," (time %d)\n", plevel->time_left); - fprintf(fi," (width %d)\n", plevel->width); - fprintf(fi," (gravity %2.1f)\n", plevel->gravity); + fprintf(fi," (name \"%s\")\n", name.c_str()); + fprintf(fi," (theme \"%s\")\n", theme.c_str()); + fprintf(fi," (music \"%s\")\n", song_title.c_str()); + fprintf(fi," (background \"%s\")\n", bkgd_image.c_str()); + fprintf(fi," (particle_system \"%s\")\n", particle_system.c_str()); + fprintf(fi," (bkgd_red %d)\n", bkgd_red); + fprintf(fi," (bkgd_green %d)\n", bkgd_green); + fprintf(fi," (bkgd_blue %d)\n", bkgd_blue); + fprintf(fi," (time %d)\n", time_left); + fprintf(fi," (width %d)\n", width); + fprintf(fi," (gravity %2.1f)\n", gravity); fprintf(fi," (background-tm "); - for(y = 0; y < 15; ++y) + for(int y = 0; y < 15; ++y) { - for(i = 0; i < plevel->width; ++i) - fprintf(fi," %d ", plevel->bg_tiles[y][i]); + for(int i = 0; i < width; ++i) + fprintf(fi," %d ", bg_tiles[y][i]); } fprintf( fi,")\n"); fprintf(fi," (interactive-tm "); - for(y = 0; y < 15; ++y) + for(int y = 0; y < 15; ++y) { - for(i = 0; i < plevel->width; ++i) - fprintf(fi," %d ", plevel->ia_tiles[y][i]); + for(int i = 0; i < width; ++i) + fprintf(fi," %d ", ia_tiles[y][i]); } fprintf( fi,")\n"); fprintf(fi," (foreground-tm "); - for(y = 0; y < 15; ++y) + for(int y = 0; y < 15; ++y) { - for(i = 0; i < plevel->width; ++i) - fprintf(fi," %d ", plevel->fg_tiles[y][i]); + for(int i = 0; i < width; ++i) + fprintf(fi," %d ", fg_tiles[y][i]); } fprintf( fi,")\n"); fprintf( fi,"(objects\n"); - for(std::vector<BadGuyData>::iterator it = plevel-> - badguy_data.begin(); - it != plevel->badguy_data.end(); + for(std::vector<BadGuyData>::iterator it = badguy_data.begin(); + it != badguy_data.end(); ++it) fprintf( fi,"(%s (x %d) (y %d))\n",badguykind_to_string((*it).kind).c_str(),(*it).x,(*it).y); @@ -527,7 +525,7 @@ /* Unload data for this level: */ void -st_level::cleanup() +Level::cleanup() { for(int i=0; i < 15; ++i) free(bg_tiles[i]); @@ -546,43 +544,43 @@ /* Load graphics: */ -void level_load_gfx(st_level *plevel) +void +Level::load_gfx() { - level_load_image(&img_brick[0],plevel->theme,"brick0.png", IGNORE_ALPHA); - level_load_image(&img_brick[1],plevel->theme,"brick1.png", IGNORE_ALPHA); + level_load_image(&img_brick[0],theme,"brick0.png", IGNORE_ALPHA); + level_load_image(&img_brick[1],theme,"brick1.png", IGNORE_ALPHA); - level_load_image(&img_solid[0],plevel->theme,"solid0.png", USE_ALPHA); - level_load_image(&img_solid[1],plevel->theme,"solid1.png", USE_ALPHA); - level_load_image(&img_solid[2],plevel->theme,"solid2.png", USE_ALPHA); - level_load_image(&img_solid[3],plevel->theme,"solid3.png", USE_ALPHA); + level_load_image(&img_solid[0],theme,"solid0.png", USE_ALPHA); + level_load_image(&img_solid[1],theme,"solid1.png", USE_ALPHA); + level_load_image(&img_solid[2],theme,"solid2.png", USE_ALPHA); + level_load_image(&img_solid[3],theme,"solid3.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[0][0],plevel->theme,"bkgd-00.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[0][1],plevel->theme,"bkgd-01.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[0][2],plevel->theme,"bkgd-02.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[0][3],plevel->theme,"bkgd-03.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[0][0],theme,"bkgd-00.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[0][1],theme,"bkgd-01.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[0][2],theme,"bkgd-02.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[0][3],theme,"bkgd-03.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[1][0],plevel->theme,"bkgd-10.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[1][1],plevel->theme,"bkgd-11.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[1][2],plevel->theme,"bkgd-12.png", USE_ALPHA); - level_load_image(&img_bkgd_tile[1][3],plevel->theme,"bkgd-13.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[1][0],theme,"bkgd-10.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[1][1],theme,"bkgd-11.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[1][2],theme,"bkgd-12.png", USE_ALPHA); + level_load_image(&img_bkgd_tile[1][3],theme,"bkgd-13.png", USE_ALPHA); - if(!plevel->bkgd_image.empty()) + if(!bkgd_image.empty()) { char fname[1024]; - snprintf(fname, 1024, "%s/background/%s", st_dir, plevel->bkgd_image.c_str()); + snprintf(fname, 1024, "%s/background/%s", st_dir, bkgd_image.c_str()); if(!faccessible(fname)) - snprintf(fname, 1024, "%s/images/background/%s", datadir.c_str(), plevel->bkgd_image.c_str()); + snprintf(fname, 1024, "%s/images/background/%s", datadir.c_str(), bkgd_image.c_str()); texture_load(&img_bkgd, fname, IGNORE_ALPHA); } else { /* Quick hack to make sure an image is loaded, when we are freeing it afterwards. */# - level_load_image(&img_bkgd, plevel->theme,"solid0.png", IGNORE_ALPHA); + level_load_image(&img_bkgd, theme,"solid0.png", IGNORE_ALPHA); } } /* Free graphics data for this level: */ - void level_free_gfx(void) { int i; @@ -628,38 +626,37 @@ } /* Change the size of a level (width) */ -void level_change_size (st_level* plevel, int new_width) +void +Level::change_size (int new_width) { if(new_width < 21) new_width = 21; - tilemap_change_size((unsigned int***)&plevel->ia_tiles,new_width,plevel->width); - tilemap_change_size((unsigned int***)&plevel->bg_tiles,new_width,plevel->width); - tilemap_change_size((unsigned int***)&plevel->fg_tiles,new_width,plevel->width); - plevel->width = new_width; -} + tilemap_change_size((unsigned int***)&ia_tiles, new_width, width); + tilemap_change_size((unsigned int***)&bg_tiles, new_width, width); + tilemap_change_size((unsigned int***)&fg_tiles, new_width, width); -/* Edit a piece of the map! */ + width = new_width; +} -void level_change(st_level* plevel, float x, float y, int tm, unsigned int c) +void +Level::change(float x, float y, int tm, unsigned int c) { - int xx, yy; - - yy = ((int)y / 32); - xx = ((int)x / 32); + int yy = ((int)y / 32); + int xx = ((int)x / 32); - if (yy >= 0 && yy < 15 && xx >= 0 && xx <= plevel->width) + if (yy >= 0 && yy < 15 && xx >= 0 && xx <= width) { switch(tm) { case TM_BG: - plevel->bg_tiles[yy][xx] = c; + bg_tiles[yy][xx] = c; break; case TM_IA: - plevel->ia_tiles[yy][xx] = c; + ia_tiles[yy][xx] = c; break; case TM_FG: - plevel->fg_tiles[yy][xx] = c; + fg_tiles[yy][xx] = c; break; } } @@ -675,20 +672,20 @@ /* Load music: */ -void level_load_song(st_level* plevel) +void +Level::load_song() { + char* song_path; + char* song_subtitle; - char * song_path; - char * song_subtitle; - - level_song = load_song(datadir + "/music/" + plevel->song_title); + level_song = ::load_song(datadir + "/music/" + song_title); song_path = (char *) malloc(sizeof(char) * datadir.length() + - strlen(plevel->song_title.c_str()) + 8 + 5); - song_subtitle = strdup(plevel->song_title.c_str()); + strlen(song_title.c_str()) + 8 + 5); + song_subtitle = strdup(song_title.c_str()); strcpy(strstr(song_subtitle, "."), "\0"); - sprintf(song_path, "%s/music/%s-fast%s", datadir.c_str(), song_subtitle, strstr(plevel->song_title.c_str(), ".")); - level_song_fast = load_song(song_path); + sprintf(song_path, "%s/music/%s-fast%s", datadir.c_str(), song_subtitle, strstr(song_title.c_str(), ".")); + level_song_fast = ::load_song(song_path); free(song_subtitle); free(song_path); } Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- leveleditor.cpp 10 Apr 2004 19:40:48 -0000 1.29 +++ leveleditor.cpp 10 Apr 2004 20:16:15 -0000 1.30 @@ -86,7 +86,7 @@ static bool le_level_changed; /* if changes, ask for saving, when quiting*/ static int pos_x, cursor_x, cursor_y, fire; static int le_level; -static st_level* le_current_level; +static Level* le_current_level; static st_subset le_level_subset; static int le_show_grid; static int le_frame; @@ -244,14 +244,14 @@ le_level = 1; arrays_free(); loadshared(); - le_current_level = new st_level; + le_current_level = new Level; if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) { le_quit(); return 1; } le_set_defaults(); - level_load_gfx(le_current_level); + le_current_level->load_gfx(); activate_bad_guys(le_current_level); show_menu = true; } @@ -275,14 +275,14 @@ le_level = 1; arrays_free(); loadshared(); - le_current_level = new st_level; + le_current_level = new Level; if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) { le_quit(); return 1; } le_set_defaults(); - level_load_gfx(le_current_level); + le_current_level->load_gfx(); activate_bad_guys(le_current_level); menu_item_change_input(&subset_new_menu->item[2],""); show_menu = true; @@ -520,12 +520,12 @@ if(i) { level_free_gfx(); - level_load_gfx(le_current_level); + le_current_level->load_gfx(); } le_current_level->song_title = string_list_active(level_settings_menu->item[4].list); - level_change_size(le_current_level, atoi(level_settings_menu->item[6].input)); + le_current_level->change_size(atoi(level_settings_menu->item[6].input)); le_current_level->time_left = atoi(level_settings_menu->item[7].input); le_current_level->gravity = atof(level_settings_menu->item[8].input); le_current_level->bkgd_red = atoi(level_settings_menu->item[9].input); @@ -558,7 +558,7 @@ level_free_gfx(); - level_load_gfx(le_current_level); + le_current_level->load_gfx(); activate_bad_guys(le_current_level); } @@ -915,7 +915,7 @@ le_testlevel(); le_save_level_bt->event(event); if(le_save_level_bt->get_state() == BUTTON_CLICKED) - level_save(le_current_level,le_level_subset.name.c_str(),le_level); + le_current_level->save(le_level_subset.name.c_str(),le_level); le_exit_bt->event(event); if(le_exit_bt->get_state() == BUTTON_CLICKED) { @@ -931,7 +931,7 @@ } else { - st_level new_lev; + Level new_lev; char str[1024]; int d = 0; sprintf(str,"Level %d doesn't exist.",le_level+1); @@ -949,7 +949,7 @@ { case SDLK_y: new_lev.init_defaults(); - level_save(&new_lev,le_level_subset.name.c_str(),++le_level); + new_lev.save(le_level_subset.name.c_str(),++le_level); le_level_subset.levels = le_level; le_goto_level(le_level); d = 1; @@ -1113,7 +1113,7 @@ switch(le_selection_mode) { case CURSOR: - level_change(le_current_level,x,y,tm,c); + le_current_level->change(x,y,tm,c); yy = ((int)y / 32); xx = ((int)x / 32); @@ -1167,7 +1167,7 @@ for(xx = x1; xx <= x2; xx++) for(yy = y1; yy <= y2; yy++) { - level_change(le_current_level, xx*32, yy*32, tm, c); + le_current_level->change(xx*32, yy*32, tm, c); if(c == '0') // if it's a bad guy add_bad_guy(xx*32, yy*32, BAD_BSOD); @@ -1185,11 +1185,11 @@ void le_testlevel() { - level_save(le_current_level,"test",le_level); + le_current_level->save("test", le_level); gameloop("test",le_level, ST_GL_TEST); Menu::set_current(leveleditor_menu); arrays_free(); - level_load_gfx(le_current_level); + le_current_level->load_gfx(); loadshared(); activate_bad_guys(le_current_level); } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- gameloop.cpp 10 Apr 2004 19:49:49 -0000 1.45 +++ gameloop.cpp 10 Apr 2004 20:16:15 -0000 1.46 @@ -44,7 +44,7 @@ /* extern variables */ -st_level current_level; +Level current_level; int game_started = false; /* Local variables: */ @@ -99,7 +99,7 @@ update_time = st_get_ticks(); } -void activate_bad_guys(st_level* plevel) +void activate_bad_guys(Level* plevel) { for (std::vector<BadGuyData>::iterator i = plevel->badguy_data.begin(); i != plevel->badguy_data.end(); @@ -374,9 +374,9 @@ activate_bad_guys(¤t_level); activate_particle_systems(); level_free_gfx(); - level_load_gfx(¤t_level); + current_level.load_gfx(); level_free_song(); - level_load_song(¤t_level); + current_level.load_song(); if(st_gl_mode != ST_GL_TEST) levelintro(); start_timers(); @@ -608,11 +608,11 @@ exit(1); } - level_load_gfx(¤t_level); + current_level.load_gfx(); loadshared(); activate_bad_guys(¤t_level); activate_particle_systems(); - level_load_song(¤t_level); + current_level.load_song(); tux.init(); @@ -1214,7 +1214,7 @@ } if (distro_counter <= 0) - level_change(¤t_level,x, y, TM_IA, tile->next_tile); + current_level.change(x, y, TM_IA, tile->next_tile); play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); score = score + SCORE_DISTRO; @@ -1223,7 +1223,7 @@ else if (!small) { /* Get rid of it: */ - level_change(¤t_level,x, y, TM_IA, tile->next_tile); + current_level.change(x, y, TM_IA, tile->next_tile); /* Replace it with broken bits: */ add_broken_brick(((int)(x + 1) / 32) * 32, @@ -1285,7 +1285,7 @@ } /* Empty the box: */ - level_change(¤t_level,x, y, TM_IA, tile->next_tile); + current_level.change(x, y, TM_IA, tile->next_tile); } /* Try to grab a distro: */ @@ -1294,7 +1294,7 @@ Tile* tile = gettile(x, y); if (tile && tile->distro) { - level_change(¤t_level,x, y, TM_IA, tile->next_tile); + current_level.change(x, y, TM_IA, tile->next_tile); play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); if (bounciness == BOUNCE) @@ -1489,9 +1489,9 @@ activate_bad_guys(¤t_level); activate_particle_systems(); level_free_gfx(); - level_load_gfx(¤t_level); + current_level.load_gfx(); level_free_song(); - level_load_song(¤t_level); + current_level.load_song(); levelintro(); update_time = st_get_ticks(); |
From: Ingo R. <gr...@us...> - 2004-04-10 20:03:21
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6897 Modified Files: gameloop.cpp level.cpp level.h title.cpp Log Message: - more c++-ification Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- gameloop.cpp 10 Apr 2004 19:40:48 -0000 1.44 +++ gameloop.cpp 10 Apr 2004 19:49:49 -0000 1.45 @@ -361,7 +361,7 @@ if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) { - if(level_load(¤t_level, level_subset) != 0) + if(current_level.load(level_subset) != 0) return 0; } else @@ -599,7 +599,7 @@ if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) { - if (level_load(¤t_level, level_subset)) + if (current_level.load(level_subset)) exit(1); } else Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- title.cpp 10 Apr 2004 19:40:49 -0000 1.25 +++ title.cpp 10 Apr 2004 19:49:49 -0000 1.26 @@ -142,7 +142,7 @@ st_pause_ticks_init(); - level_load(¤t_level, (datadir + "/levels/misc/menu.stl").c_str()); + current_level.load((datadir + "/levels/misc/menu.stl").c_str()); loadshared(); activate_particle_systems(); /* Lower the gravity that tux doesn't jump to hectically through the demo */ Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- level.cpp 10 Apr 2004 19:40:48 -0000 1.23 +++ level.cpp 10 Apr 2004 19:49:49 -0000 1.24 @@ -241,10 +241,11 @@ if(!faccessible(filename)) snprintf(filename, 1024, "%s/levels/%s/level%d.stl", datadir.c_str(), subset, level); - return level_load(this, filename); + return load(filename); } -int level_load(st_level* plevel, const char* filename) +int +st_level::load(const char* filename) { FILE * fi; lisp_object_t* root_obj = 0; @@ -274,17 +275,17 @@ LispReader reader(lisp_cdr(root_obj)); reader.read_int("version", &version); - reader.read_int("width", &plevel->width); - reader.read_int("time", &plevel->time_left); - reader.read_int("bkgd_red", &plevel->bkgd_red); - reader.read_int("bkgd_green", &plevel->bkgd_green); - reader.read_int("bkgd_blue", &plevel->bkgd_blue); - reader.read_float("gravity", &plevel->gravity); - reader.read_string("name", &plevel->name); - reader.read_string("theme", &plevel->theme); - reader.read_string("music", &plevel->song_title); - reader.read_string("background", &plevel->bkgd_image); - reader.read_string("particle_system", &plevel->particle_system); + reader.read_int("width", &width); + reader.read_int("time", &time_left); + reader.read_int("bkgd_red", &bkgd_red); + reader.read_int("bkgd_green", &bkgd_green); + reader.read_int("bkgd_blue", &bkgd_blue); + reader.read_float("gravity", &gravity); + reader.read_string("name", &name); + reader.read_string("theme", &theme); + reader.read_string("music", &song_title); + reader.read_string("background", &bkgd_image); + reader.read_string("particle_system", &particle_system); reader.read_int_vector("background-tm", &bg_tm); if (!reader.read_int_vector("interactive-tm", &ia_tm)) @@ -306,7 +307,7 @@ reader.read_int("x", &bg_data.x); reader.read_int("y", &bg_data.y); - plevel->badguy_data.push_back(bg_data); + badguy_data.push_back(bg_data); cur = lisp_cdr(cur); } @@ -362,7 +363,7 @@ { if (*i == '0' || *i == '1' || *i == '2') { - plevel->badguy_data.push_back(BadGuyData(static_cast<BadGuyKind>(*i-'0'), + badguy_data.push_back(BadGuyData(static_cast<BadGuyKind>(*i-'0'), x*32, y*32)); *i = 0; } @@ -375,7 +376,7 @@ printf("Error: conversion will fail, unsupported char: '%c' (%d)\n", *i, *i); } ++x; - if (x >= plevel->width) + if (x >= width) { x = 0; ++y; @@ -386,17 +387,17 @@ for(int i = 0; i < 15; ++i) { - plevel->ia_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); - plevel->bg_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); - plevel->fg_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); + ia_tiles[i] = (unsigned int*) calloc((width +1) , sizeof(unsigned int) ); + bg_tiles[i] = (unsigned int*) calloc((width +1) , sizeof(unsigned int) ); + fg_tiles[i] = (unsigned int*) calloc((width +1) , sizeof(unsigned int) ); } int i = 0; int j = 0; for(vector<int>::iterator it = ia_tm.begin(); it != ia_tm.end(); ++it, ++i) { - plevel->ia_tiles[j][i] = (*it); - if(i == plevel->width - 1) + ia_tiles[j][i] = (*it); + if(i == width - 1) { i = -1; ++j; @@ -407,8 +408,8 @@ for(vector<int>::iterator it = bg_tm.begin(); it != bg_tm.end(); ++it, ++i) { - plevel->bg_tiles[j][i] = (*it); - if(i == plevel->width - 1) + bg_tiles[j][i] = (*it); + if(i == width - 1) { i = -1; ++j; @@ -419,21 +420,21 @@ for(vector<int>::iterator it = fg_tm.begin(); it != fg_tm.end(); ++it, ++i) { - plevel->fg_tiles[j][i] = (*it); - if(i == plevel->width - 1) + fg_tiles[j][i] = (*it); + if(i == width - 1) { i = -1; ++j; } } - /* Set the global gravity to the latest loaded level's gravity */ - gravity = plevel->gravity; + // FIXME: Set the global gravity to the latest loaded level's gravity + ::gravity = gravity; // Mark the end position of this level! // FIXME: -10 is a rather random value, we still need some kind of // real levelend gola - endpos = 32*(plevel->width-10); + endpos = 32*(width-10); fclose(fi); return 0; Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- level.h 10 Apr 2004 19:40:48 -0000 1.17 +++ level.h 10 Apr 2004 19:49:49 -0000 1.18 @@ -82,9 +82,10 @@ void cleanup(); int load(const char * subset, int level); + int load(const char* filename); + }; -int level_load (st_level* plevel, const char* filename); void level_save (st_level* plevel, const char * subset, int level); void level_load_gfx (st_level* plevel); void level_change (st_level* plevel, float x, float y, int tm, unsigned int c); |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4728 Modified Files: gameloop.cpp gameloop.h level.cpp level.h leveleditor.cpp player.cpp scene.cpp setup.cpp title.cpp world.cpp Log Message: - some indent fixes - started to turn st_level into a proper class Index: scene.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/scene.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- scene.cpp 4 Apr 2004 00:32:10 -0000 1.11 +++ scene.cpp 10 Apr 2004 19:40:49 -0000 1.12 @@ -47,24 +47,23 @@ void arrays_free(void) { -bad_guys.clear(); -bouncy_distros.clear(); -broken_bricks.clear(); -bouncy_bricks.clear(); -floating_scores.clear(); -upgrades.clear(); -bullets.clear(); -std::vector<ParticleSystem*>::iterator i; -for(i = particle_systems.begin(); i != particle_systems.end(); ++i) { - delete *i; -} -particle_systems.clear(); + bad_guys.clear(); + bouncy_distros.clear(); + broken_bricks.clear(); + bouncy_bricks.clear(); + floating_scores.clear(); + upgrades.clear(); + bullets.clear(); + std::vector<ParticleSystem*>::iterator i; + for(i = particle_systems.begin(); i != particle_systems.end(); ++i) { + delete *i; + } + particle_systems.clear(); } void set_defaults(void) { - /* Set defaults: */ - + // Set defaults: scroll_x = 0; score_multiplier = 1; Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- gameloop.h 10 Apr 2004 18:56:17 -0000 1.23 +++ gameloop.h 10 Apr 2004 19:40:48 -0000 1.24 @@ -24,25 +24,22 @@ #define ST_GL_LOAD_GAME 2 #define ST_GL_LOAD_LEVEL_FILE 3 -extern int game_started; +// FIXME: Make this local to the gamesession extern st_level current_level; +extern int game_started; + /* Function prototypes: */ class Tile; -Tile* gettile(float x, float y); -void activate_bad_guys(st_level* plevel); -int gameloop(const char * subset, int levelnb, int mode); -void savegame(int slot); -void loadgame(int slot); +void activate_bad_guys(st_level* plevel); +int gameloop(const char * subset, int levelnb, int mode); +void savegame(int slot); +void loadgame(int slot); std::string slotinfo(int slot); -bool issolid(float x, float y); -bool isbrick(float x, float y); -bool isice(float x, float y); -bool isfullbox(float x, float y); -bool rectcollision(base_type* one, base_type* two); -void drawshape(float x, float y, unsigned int c, Uint8 alpha = 255); -unsigned int shape(float x, float y); + +bool rectcollision(base_type* one, base_type* two); +void drawshape(float x, float y, unsigned int c, Uint8 alpha = 255); void bumpbrick(float x, float y); /** Try to grab the coin at the given coordinates */ Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- setup.cpp 10 Apr 2004 18:56:17 -0000 1.25 +++ setup.cpp 10 Apr 2004 19:40:49 -0000 1.26 @@ -465,14 +465,15 @@ // FIXME: Insert a real savegame struct/class here instead of // doing string vodoo std::string tmp = slotinfo(slot-1); + if (tmp.length() == strlen("Slot X - Free")) - { + { // Slot is free, so start a new game gameloop("default", 1, ST_GL_PLAY); show_menu = true; Menu::set_current(main_menu); } else - { + { // Slot contains a level, so load it if (game_started) { gameloop("default",slot - 1,ST_GL_LOAD_GAME); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- leveleditor.cpp 4 Apr 2004 00:32:10 -0000 1.28 +++ leveleditor.cpp 10 Apr 2004 19:40:48 -0000 1.29 @@ -245,7 +245,7 @@ arrays_free(); loadshared(); le_current_level = new st_level; - if(level_load(le_current_level, le_level_subset.name.c_str(), le_level) != 0) + if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) { le_quit(); return 1; @@ -276,7 +276,7 @@ arrays_free(); loadshared(); le_current_level = new st_level; - if(level_load(le_current_level, le_level_subset.name.c_str(), le_level) != 0) + if(le_current_level->load(le_level_subset.name.c_str(), le_level) != 0) { le_quit(); return 1; @@ -544,10 +544,10 @@ { arrays_free(); - level_free(le_current_level); - if(level_load(le_current_level, le_level_subset.name.c_str(), levelnb) != 0) + le_current_level->cleanup(); + if(le_current_level->load(le_level_subset.name.c_str(), levelnb) != 0) { - level_load(le_current_level, le_level_subset.name.c_str(), le_level); + le_current_level->load(le_level_subset.name.c_str(), le_level); } else { @@ -594,7 +594,7 @@ if(le_current_level != NULL) { level_free_gfx(); - level_free(le_current_level); + le_current_level->cleanup(); unloadshared(); arrays_free(); } @@ -948,7 +948,7 @@ switch(event.key.keysym.sym) { case SDLK_y: - level_default(&new_lev); + new_lev.init_defaults(); level_save(&new_lev,le_level_subset.name.c_str(),++le_level); le_level_subset.levels = le_level; le_goto_level(le_level); Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- player.cpp 9 Apr 2004 16:25:17 -0000 1.21 +++ player.cpp 10 Apr 2004 19:40:48 -0000 1.22 @@ -930,10 +930,9 @@ } else if (base.x> screen->w / 2 + scroll_x && scroll_x < ((current_level.width * 32) - screen->w)) { - /* Scroll the screen in past center: */ + // Scroll the screen in past center: - scroll_x = base.x- screen->w / 2; - /*base.x= 320 + scroll_x;*/ + scroll_x = base.x - screen->w / 2; if (scroll_x > ((current_level.width * 32) - screen->w)) scroll_x = ((current_level.width * 32) - screen->w); Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- title.cpp 10 Apr 2004 18:56:17 -0000 1.24 +++ title.cpp 10 Apr 2004 19:40:49 -0000 1.25 @@ -75,14 +75,13 @@ (*p)->simulate(frame_ratio); } - /* Draw particle systems (background) */ + // Draw particle systems (background) for(p = particle_systems.begin(); p != particle_systems.end(); ++p) { (*p)->draw(scroll_x, 0, 0); } - /* Draw interactive tiles: */ - + // Draw interactive tiles: for (int y = 0; y < 15; ++y) { for (int x = 0; x < 21; ++x) Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- level.h 27 Mar 2004 00:38:47 -0000 1.16 +++ level.h 10 Apr 2004 19:40:48 -0000 1.17 @@ -18,8 +18,10 @@ #include "badguy.h" #include "lispreader.h" -/* This type holds meta-information about a level-subset. */ -/* It could be extended to handle manipulation of subsets. */ +class Tile; + +/** This type holds meta-information about a level-subset. + It could be extended to handle manipulation of subsets. */ class st_subset { public: @@ -73,14 +75,17 @@ std::vector<BadGuyData> badguy_data; public: + /** Will the Level structure with default values */ + void init_defaults(); + + /** Cleanup the level struct from allocated tile data and such */ + void cleanup(); + + int load(const char * subset, int level); }; -void level_default (st_level* plevel); -int level_load (st_level* plevel, const char * subset, int level); -void level_parse (st_level* plevel, lisp_object_t* cursor); int level_load (st_level* plevel, const char* filename); void level_save (st_level* plevel, const char * subset, int level); -void level_free (st_level* plevel); void level_load_gfx (st_level* plevel); void level_change (st_level* plevel, float x, float y, int tm, unsigned int c); void level_change_size (st_level* plevel, int new_width); @@ -89,4 +94,16 @@ void level_load_image(texture_type* ptexture, std::string theme, const char * file, int use_alpha); void level_free_song(void); +/** Return the id of the tile at the given x/y coordinates */ +unsigned int gettileid(float x, float y); + +/** Return a pointer to the tile at the given x/y coordinates */ +Tile* gettile(float x, float y); + +// Some little helper function to check for tile properties +bool issolid(float x, float y); +bool isbrick(float x, float y); +bool isice(float x, float y); +bool isfullbox(float x, float y); + #endif /*SUPERTUX_LEVEL_H*/ Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- world.cpp 22 Mar 2004 15:52:35 -0000 1.4 +++ world.cpp 10 Apr 2004 19:40:49 -0000 1.5 @@ -29,19 +29,19 @@ void bouncy_distro_action(bouncy_distro_type* pbouncy_distro) { - pbouncy_distro->base.y = pbouncy_distro->base.y + pbouncy_distro->base.ym * frame_ratio; + pbouncy_distro->base.y = pbouncy_distro->base.y + pbouncy_distro->base.ym * frame_ratio; - pbouncy_distro->base.ym += 0.1 * frame_ratio; + pbouncy_distro->base.ym += 0.1 * frame_ratio; - if (pbouncy_distro->base.ym >= 0) - bouncy_distros.erase(static_cast<std::vector<bouncy_distro_type>::iterator>(pbouncy_distro)); + if (pbouncy_distro->base.ym >= 0) + bouncy_distros.erase(static_cast<std::vector<bouncy_distro_type>::iterator>(pbouncy_distro)); } void bouncy_distro_draw(bouncy_distro_type* pbouncy_distro) { - texture_draw(&img_distro[0], - pbouncy_distro->base.x - scroll_x, - pbouncy_distro->base.y); + texture_draw(&img_distro[0], + pbouncy_distro->base.x - scroll_x, + pbouncy_distro->base.y); } void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float xm, float ym) @@ -56,27 +56,27 @@ void broken_brick_action(broken_brick_type* pbroken_brick) { - pbroken_brick->base.x = pbroken_brick->base.x + pbroken_brick->base.xm * frame_ratio; - pbroken_brick->base.y = pbroken_brick->base.y + pbroken_brick->base.ym * frame_ratio; + pbroken_brick->base.x = pbroken_brick->base.x + pbroken_brick->base.xm * frame_ratio; + pbroken_brick->base.y = pbroken_brick->base.y + pbroken_brick->base.ym * frame_ratio; - if (!timer_check(&pbroken_brick->timer)) - broken_bricks.erase(static_cast<std::vector<broken_brick_type>::iterator>(pbroken_brick)); + if (!timer_check(&pbroken_brick->timer)) + broken_bricks.erase(static_cast<std::vector<broken_brick_type>::iterator>(pbroken_brick)); } void broken_brick_draw(broken_brick_type* pbroken_brick) { -SDL_Rect src, dest; - src.x = rand() % 16; - src.y = rand() % 16; - src.w = 16; - src.h = 16; + SDL_Rect src, dest; + src.x = rand() % 16; + src.y = rand() % 16; + src.w = 16; + src.h = 16; - dest.x = (int)(pbroken_brick->base.x - scroll_x); - dest.y = (int)pbroken_brick->base.y; - dest.w = 16; - dest.h = 16; + dest.x = (int)(pbroken_brick->base.x - scroll_x); + dest.y = (int)pbroken_brick->base.y; + dest.w = 16; + dest.h = 16; - texture_draw_part(&img_brick[0],src.x,src.y,dest.x,dest.y,dest.w,dest.h); + texture_draw_part(&img_brick[0],src.x,src.y,dest.x,dest.y,dest.w,dest.h); } void bouncy_brick_init(bouncy_brick_type* pbouncy_brick, float x, float y) @@ -85,25 +85,25 @@ pbouncy_brick->base.y = y; pbouncy_brick->offset = 0; pbouncy_brick->offset_m = -BOUNCY_BRICK_SPEED; - pbouncy_brick->shape = shape(x, y); + pbouncy_brick->shape = gettileid(x, y); } void bouncy_brick_action(bouncy_brick_type* pbouncy_brick) { - pbouncy_brick->offset = (pbouncy_brick->offset + - pbouncy_brick->offset_m * frame_ratio); + pbouncy_brick->offset = (pbouncy_brick->offset + + pbouncy_brick->offset_m * frame_ratio); - /* Go back down? */ + /* Go back down? */ - if (pbouncy_brick->offset < -BOUNCY_BRICK_MAX_OFFSET) - pbouncy_brick->offset_m = BOUNCY_BRICK_SPEED; + if (pbouncy_brick->offset < -BOUNCY_BRICK_MAX_OFFSET) + pbouncy_brick->offset_m = BOUNCY_BRICK_SPEED; - /* Stop bouncing? */ + /* Stop bouncing? */ - if (pbouncy_brick->offset >= 0) - bouncy_bricks.erase(static_cast<std::vector<bouncy_brick_type>::iterator>(pbouncy_brick)); + if (pbouncy_brick->offset >= 0) + bouncy_bricks.erase(static_cast<std::vector<bouncy_brick_type>::iterator>(pbouncy_brick)); } void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick) @@ -111,29 +111,32 @@ int s; SDL_Rect dest; - if (pbouncy_brick->base.x >= scroll_x - 32 && - pbouncy_brick->base.x <= scroll_x + screen->w) - { - dest.x = (int)(pbouncy_brick->base.x - scroll_x); - dest.y = (int)pbouncy_brick->base.y; - dest.w = 32; - dest.h = 32; - - if(current_level.bkgd_image[0] == '\0') - { - fillrect(pbouncy_brick->base.x - scroll_x,pbouncy_brick->base.y,32,32,current_level.bkgd_red,current_level.bkgd_green, - current_level.bkgd_blue,0); - } - else - { - s = (int)scroll_x / 30; - texture_draw_part(&img_bkgd,dest.x + s,dest.y,dest.x,dest.y,dest.w,dest.h); - } + if (pbouncy_brick->base.x >= scroll_x - 32 && + pbouncy_brick->base.x <= scroll_x + screen->w) + { + dest.x = (int)(pbouncy_brick->base.x - scroll_x); + dest.y = (int)pbouncy_brick->base.y; + dest.w = 32; + dest.h = 32; - drawshape(pbouncy_brick->base.x - scroll_x, - pbouncy_brick->base.y + pbouncy_brick->offset, - pbouncy_brick->shape); + // FIXME: overdrawing hack to clean the tile from the screen to + // paint it later at on offseted position + if(current_level.bkgd_image[0] == '\0') + { + fillrect(pbouncy_brick->base.x - scroll_x, pbouncy_brick->base.y, + 32,32,current_level.bkgd_red,current_level.bkgd_green, + current_level.bkgd_blue,0); } + else + { + s = (int)scroll_x / 30; + texture_draw_part(&img_bkgd,dest.x + s,dest.y,dest.x,dest.y,dest.w,dest.h); + } + + drawshape(pbouncy_brick->base.x - scroll_x, + pbouncy_brick->base.y + pbouncy_brick->offset, + pbouncy_brick->shape); + } } void floating_score_init(floating_score_type* pfloating_score, float x, float y, int s) @@ -147,16 +150,18 @@ void floating_score_action(floating_score_type* pfloating_score) { - pfloating_score->base.y = pfloating_score->base.y - 2 * frame_ratio; + pfloating_score->base.y = pfloating_score->base.y - 2 * frame_ratio; - if(!timer_check(&pfloating_score->timer)) - floating_scores.erase(static_cast<std::vector<floating_score_type>::iterator>(pfloating_score)); + if(!timer_check(&pfloating_score->timer)) + floating_scores.erase(static_cast<std::vector<floating_score_type>::iterator>(pfloating_score)); } void floating_score_draw(floating_score_type* pfloating_score) { - char str[10]; - sprintf(str, "%d", pfloating_score->value); - text_draw(&gold_text, str, (int)pfloating_score->base.x + 16 - strlen(str) * 8, (int)pfloating_score->base.y, 1); + char str[10]; + sprintf(str, "%d", pfloating_score->value); + text_draw(&gold_text, str, (int)pfloating_score->base.x + 16 - strlen(str) * 8, (int)pfloating_score->base.y, 1); } +/* EOF */ + Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- level.cpp 3 Apr 2004 13:31:14 -0000 1.22 +++ level.cpp 10 Apr 2004 19:40:48 -0000 1.23 @@ -21,6 +21,7 @@ #include "level.h" #include "physic.h" #include "scene.h" +#include "tile.h" #include "lispreader.h" using namespace std; @@ -40,7 +41,7 @@ new_subset.title = "Unknown Title"; new_subset.description = "No description so far."; new_subset.save(); - level_default(&new_lev); + new_lev.init_defaults(); level_save(&new_lev,subset_name.c_str(),1); } @@ -191,45 +192,46 @@ levels = 0; } -void level_default(st_level* plevel) +void +st_level::init_defaults() { - int i,y; - plevel->name = "UnNamed"; - plevel->theme = "antarctica"; - plevel->song_title = "Mortimers_chipdisko.mod"; - plevel->bkgd_image = "arctis.png"; - plevel->width = 21; - plevel->time_left = 100; - plevel->gravity = 10.; - plevel->bkgd_red = 0; - plevel->bkgd_green = 0; - plevel->bkgd_blue = 0; + name = "UnNamed"; + theme = "antarctica"; + song_title = "Mortimers_chipdisko.mod"; + bkgd_image = "arctis.png"; + width = 21; + time_left = 100; + gravity = 10.; + bkgd_red = 0; + bkgd_green = 0; + bkgd_blue = 0; - for(i = 0; i < 15; ++i) + for(int i = 0; i < 15; ++i) { - plevel->ia_tiles[i] = (unsigned int*) malloc((plevel->width+1)*sizeof(unsigned int)); - plevel->ia_tiles[i][plevel->width] = (unsigned int) '\0'; - for(y = 0; y < plevel->width; ++y) - plevel->ia_tiles[i][y] = 0; - plevel->ia_tiles[i][plevel->width] = (unsigned int) '\0'; + ia_tiles[i] = (unsigned int*) malloc((width+1)*sizeof(unsigned int)); + ia_tiles[i][width] = (unsigned int) '\0'; + for(int y = 0; y < width; ++y) + ia_tiles[i][y] = 0; + ia_tiles[i][width] = (unsigned int) '\0'; - plevel->bg_tiles[i] = (unsigned int*) malloc((plevel->width+1)*sizeof(unsigned int)); - plevel->bg_tiles[i][plevel->width] = (unsigned int) '\0'; - for(y = 0; y < plevel->width; ++y) - plevel->bg_tiles[i][y] = 0; - plevel->bg_tiles[i][plevel->width] = (unsigned int) '\0'; + bg_tiles[i] = (unsigned int*) malloc((width+1)*sizeof(unsigned int)); + bg_tiles[i][width] = (unsigned int) '\0'; + for(int y = 0; y < width; ++y) + bg_tiles[i][y] = 0; + bg_tiles[i][width] = (unsigned int) '\0'; - plevel->fg_tiles[i] = (unsigned int*) malloc((plevel->width+1)*sizeof(unsigned int)); - plevel->fg_tiles[i][plevel->width] = (unsigned int) '\0'; - for(y = 0; y < plevel->width; ++y) - plevel->fg_tiles[i][y] = 0; - plevel->fg_tiles[i][plevel->width] = (unsigned int) '\0'; + fg_tiles[i] = (unsigned int*) malloc((width+1)*sizeof(unsigned int)); + fg_tiles[i][width] = (unsigned int) '\0'; + for(int y = 0; y < width; ++y) + fg_tiles[i][y] = 0; + fg_tiles[i][width] = (unsigned int) '\0'; } } /* Load data for this level: */ /* Returns -1, if the loading of the level failed. */ -int level_load(st_level* plevel, const char *subset, int level) +int +st_level::load(const char *subset, int level) { char filename[1024]; @@ -239,7 +241,7 @@ if(!faccessible(filename)) snprintf(filename, 1024, "%s/levels/%s/level%d.stl", datadir.c_str(), subset, level); - return level_load(plevel, filename); + return level_load(this, filename); } int level_load(st_level* plevel, const char* filename) @@ -523,22 +525,22 @@ /* Unload data for this level: */ -void level_free(st_level* plevel) +void +st_level::cleanup() { - int i; - for(i=0; i < 15; ++i) - free(plevel->bg_tiles[i]); - for(i=0; i < 15; ++i) - free(plevel->ia_tiles[i]); - for(i=0; i < 15; ++i) - free(plevel->fg_tiles[i]); + for(int i=0; i < 15; ++i) + free(bg_tiles[i]); + for(int i=0; i < 15; ++i) + free(ia_tiles[i]); + for(int i=0; i < 15; ++i) + free(fg_tiles[i]); - plevel->name.clear(); - plevel->theme.clear(); - plevel->song_title.clear(); - plevel->bkgd_image.clear(); + name.clear(); + theme.clear(); + song_title.clear(); + bkgd_image.clear(); - plevel->badguy_data.clear(); + badguy_data.clear(); } /* Load graphics: */ @@ -689,3 +691,57 @@ free(song_subtitle); free(song_path); } + + +unsigned int gettileid(float x, float y) +{ + int xx, yy; + unsigned int c; + + yy = ((int)y / 32); + xx = ((int)x / 32); + + if (yy >= 0 && yy < 15 && xx >= 0 && xx <= current_level.width) + c = current_level.ia_tiles[yy][xx]; + else + c = 0; + + return c; +} + +Tile* gettile(float x, float y) +{ + return TileManager::instance()->get(gettileid(x, y)); +} + +bool issolid(float x, float y) +{ + Tile* tile = TileManager::instance()->get(gettileid(x,y)); + return tile && tile->solid; +} + +bool isbrick(float x, float y) +{ + Tile* tile = TileManager::instance()->get(gettileid(x,y)); + return tile && tile->brick; +} + +bool isice(float x, float y) +{ + Tile* tile = TileManager::instance()->get(gettileid(x,y)); + return tile && tile->ice; +} + +bool isfullbox(float x, float y) +{ + Tile* tile = TileManager::instance()->get(gettileid(x,y)); + return tile && tile->fullbox; +} + +bool isdistro(float x, float y) +{ + Tile* tile = TileManager::instance()->get(gettileid(x,y)); + return tile && tile->distro; +} + +/* EOF */ Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- gameloop.cpp 10 Apr 2004 18:56:17 -0000 1.43 +++ gameloop.cpp 10 Apr 2004 19:40:48 -0000 1.44 @@ -320,7 +320,7 @@ else { level_free_gfx(); - level_free(¤t_level); + current_level.cleanup(); level_free_song(); unloadshared(); arrays_free(); @@ -345,7 +345,7 @@ save_hs(score); } level_free_gfx(); - level_free(¤t_level); + current_level.cleanup(); level_free_song(); unloadshared(); arrays_free(); @@ -357,7 +357,7 @@ tux.level_begin(); set_defaults(); - level_free(¤t_level); + current_level.cleanup(); if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) { @@ -366,7 +366,7 @@ } else { - if(level_load(¤t_level,level_subset,level) != 0) + if(current_level.load(level_subset,level) != 0) return 0; } @@ -604,7 +604,7 @@ } else { - if(level_load(¤t_level, level_subset, level) != 0) + if(current_level.load(level_subset, level) != 0) exit(1); } @@ -804,7 +804,7 @@ halt_music(); level_free_gfx(); - level_free(¤t_level); + current_level.cleanup(); level_free_song(); unloadshared(); arrays_free(); @@ -1195,113 +1195,6 @@ } } - -/* What shape is at some position? */ -unsigned int shape(float x, float y) -{ - - int xx, yy; - unsigned int c; - - yy = ((int)y / 32); - xx = ((int)x / 32); - - if (yy >= 0 && yy < 15 && xx >= 0 && xx <= current_level.width) - { - c = current_level.ia_tiles[yy][xx]; - } - else - c = 0; - - return(c); -} - -Tile* gettile(float x, float y) -{ - return TileManager::instance()->get(shape(x, y)); -} - -bool issolid(float x, float y) -{ - Tile* tile = TileManager::instance()->get - (shape(x,y)); - if(tile) - { - if(tile->solid == true) - return true; - else - return false; - } - else - { - return false; - } -} - -/* Is it a brick? */ - -bool isbrick(float x, float y) -{ - Tile* tile = TileManager::instance()->get - (shape(x,y)); - if(tile) - { - if(tile->brick == true) - return true; - else - return false; - } - else - { - return false; - } -} - - -/* Is it ice? */ - -bool isice(float x, float y) -{ - Tile* tile = TileManager::instance()->get - (shape(x,y)); - if(tile) - { - if(tile->ice == true) - return true; - else - return false; - } - else - { - return false; - } -} - -/* Is it a full box? */ - -bool isfullbox(float x, float y) -{ - Tile* tile = TileManager::instance()->get - (shape(x,y)); - if(tile) - { - if(tile->fullbox == true) - return true; - else - return false; - } - else - { - return false; - } -} - -bool isdistro(float x, float y) -{ - Tile* tile = TileManager::instance()->get(shape(x,y)); - return tile && tile->distro; -} - /* Break a brick: */ void trybreakbrick(float x, float y, bool small) { @@ -1352,10 +1245,8 @@ (int)(y / 32) * 32); play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); - } - /* Empty a box: */ void tryemptybox(float x, float y, int col_side) { @@ -1591,8 +1482,8 @@ fread(&level,sizeof(int),1,fi); set_defaults(); - level_free(¤t_level); - if(level_load(¤t_level,level_subset,level) != 0) + current_level.cleanup(); + if(current_level.load(level_subset,level) != 0) exit(1); arrays_free(); activate_bad_guys(¤t_level); |
From: Ingo R. <gr...@us...> - 2004-04-10 19:09:50
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29477 Modified Files: gameloop.cpp gameloop.h menu.cpp menu.h setup.cpp setup.h title.cpp worldmap.cpp Log Message: - reorganized menu flow as descripted in the todo, this breaks returning from the game at the moment, since something in loading savegames is broken, but since savegames needs restructuring anyway, it shouldn't be much of a problem Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- menu.cpp 10 Apr 2004 14:53:42 -0000 1.25 +++ menu.cpp 10 Apr 2004 18:56:17 -0000 1.26 @@ -43,6 +43,7 @@ Menu* highscore_menu = 0; Menu* load_game_menu = 0; Menu* save_game_menu = 0; +Menu* contrib_menu = 0; Menu* current_menu = 0; Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- setup.cpp 10 Apr 2004 14:53:43 -0000 1.24 +++ setup.cpp 10 Apr 2004 18:56:17 -0000 1.25 @@ -11,6 +11,7 @@ */ #include <assert.h> +#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -358,15 +359,24 @@ save_game_menu = new Menu(); game_menu = new Menu(); highscore_menu = new Menu(); + contrib_menu = new Menu(); main_menu->set_pos(screen->w/2, 335); - main_menu->additem(MN_ACTION,"Start Game",0,0); - main_menu->additem(MN_GOTO,"Load Game",0,load_game_menu); - main_menu->additem(MN_GOTO,"Options",0,options_menu); + main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu); + main_menu->additem(MN_GOTO, "Contrib Levels",0,contrib_menu); + main_menu->additem(MN_GOTO, "Options",0,options_menu); main_menu->additem(MN_ACTION,"Level editor",0,0); main_menu->additem(MN_ACTION,"Credits",0,0); main_menu->additem(MN_ACTION,"Quit",0,0); + contrib_menu->additem(MN_LABEL,"Contrib Levels",0,0); + contrib_menu->additem(MN_HL,"",0,0); + contrib_menu->additem(MN_ACTION, "Some Levelset", 0, 0); + contrib_menu->additem(MN_ACTION, "Someother Levelset", 0, 0); + contrib_menu->additem(MN_ACTION, "Yet another Levelset", 0, 0); + contrib_menu->additem(MN_HL,"",0,0); + contrib_menu->additem(MN_BACK,"Back",0,0); + options_menu->additem(MN_LABEL,"Options",0,0); options_menu->additem(MN_HL,"",0,0); options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0); @@ -391,7 +401,7 @@ options_controls_menu->additem(MN_HL,"",0,0); options_controls_menu->additem(MN_BACK,"Back",0,0); - load_game_menu->additem(MN_LABEL,"Load Game",0,0); + load_game_menu->additem(MN_LABEL,"Start Game",0,0); load_game_menu->additem(MN_HL,"",0,0); load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0); load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0); @@ -427,43 +437,59 @@ { for(int i = 2; i < 7; ++i) { - char *tmp; - slotinfo(&tmp,i-1); - if(load && strlen(tmp) == strlen("Slot X - Free") ) - pmenu->item[i].kind = MN_DEACTIVE; + // FIXME: Insert a real savegame struct/class here instead of + // doing string vodoo + std::string tmp = slotinfo(i-1); + + if(load && tmp.length() == strlen("Slot X - Free")) + pmenu->item[i].kind = MN_ACTION; else pmenu->item[i].kind = MN_ACTION; - menu_item_change_text(&pmenu->item[i],tmp); - free(tmp); + menu_item_change_text(&pmenu->item[i], tmp.c_str()); } } -void process_save_load_game_menu(int save) +void process_save_game_menu() { - int slot; - switch (slot = (save ? save_game_menu->check() : load_game_menu->check())) + int slot = save_game_menu->check(); + if (slot != -1) + savegame(slot - 1); +} + +bool process_load_game_menu() +{ + int slot = load_game_menu->check(); + + if(slot != -1) { - default: - if(slot != -1) + // FIXME: Insert a real savegame struct/class here instead of + // doing string vodoo + std::string tmp = slotinfo(slot-1); + if (tmp.length() == strlen("Slot X - Free")) { - if(save) + gameloop("default", 1, ST_GL_PLAY); + show_menu = true; + Menu::set_current(main_menu); + } + else + { + if (game_started) { - savegame(slot - 1); + gameloop("default",slot - 1,ST_GL_LOAD_GAME); + show_menu = true; + Menu::set_current(main_menu); } else { - if (game_started) - { - gameloop("default",slot - 1,ST_GL_LOAD_GAME); - show_menu = true; - Menu::set_current(main_menu); - } - else - loadgame(slot - 1); + loadgame(slot - 1); } - st_pause_ticks_stop(); } - break; + st_pause_ticks_stop(); + return true; + } + else + { + return false; } } @@ -608,7 +634,7 @@ /* Set window manager stuff: */ - SDL_WM_SetCaption("Super Tux", "Super Tux"); + SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux"); } @@ -941,8 +967,7 @@ else if (strcmp(argv[i], "--version") == 0) { /* Show version: */ - - printf("Super Tux - version " VERSION "\n"); + printf("SuperTux " VERSION "\n"); exit(0); } else if (strcmp(argv[i], "--disable-sound") == 0) Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- menu.h 10 Apr 2004 14:53:43 -0000 1.26 +++ menu.h 10 Apr 2004 18:56:17 -0000 1.27 @@ -64,7 +64,6 @@ int width(); int height(); - public: timer_type effect; int arrange_left; @@ -106,6 +105,7 @@ extern bool menu_change; extern texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right; +extern Menu* contrib_menu; extern Menu* main_menu; extern Menu* game_menu; extern Menu* options_menu; Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- setup.h 24 Mar 2004 14:35:11 -0000 1.14 +++ setup.h 10 Apr 2004 18:56:17 -0000 1.15 @@ -35,7 +35,12 @@ void st_menu(void); void st_abort(const std::string& reason, const std::string& details); void process_options_menu(void); -void process_save_load_game_menu(int save); + +void process_save_game_menu(); + +/** Return true if the gameloop() was entered, false otherwise */ +bool process_load_game_menu(); + void update_load_save_game_menu(Menu* pmenu, int load); void parseargs(int argc, char * argv[]); Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- gameloop.h 3 Apr 2004 13:31:14 -0000 1.22 +++ gameloop.h 10 Apr 2004 18:56:17 -0000 1.23 @@ -35,7 +35,7 @@ int gameloop(const char * subset, int levelnb, int mode); void savegame(int slot); void loadgame(int slot); -void slotinfo(char **pinfo, int slot); +std::string slotinfo(int slot); bool issolid(float x, float y); bool isbrick(float x, float y); bool isice(float x, float y); Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- title.cpp 10 Apr 2004 14:53:43 -0000 1.23 +++ title.cpp 10 Apr 2004 18:56:17 -0000 1.24 @@ -190,7 +190,7 @@ while (SDL_PollEvent(&event)) { - menu_event(event); + menu_event(event); if (event.type == SDL_QUIT) { /* Quit event - quit: */ @@ -231,10 +231,10 @@ /* Draw the high score: */ /* - sprintf(str, "High score: %d", hs_score); - text_drawf(&gold_text, str, 0, -40, A_HMIDDLE, A_BOTTOM, 1); - sprintf(str, "by %s", hs_name); - text_drawf(&gold_text, str, 0, -20, A_HMIDDLE, A_BOTTOM, 1); + sprintf(str, "High score: %d", hs_score); + text_drawf(&gold_text, str, 0, -40, A_HMIDDLE, A_BOTTOM, 1); + sprintf(str, "by %s", hs_name); + text_drawf(&gold_text, str, 0, -20, A_HMIDDLE, A_BOTTOM, 1); */ /* Don't draw menu, if quit is true */ @@ -245,7 +245,10 @@ { switch (main_menu->check()) { +#if 0 case 0: + // Quick Play + // FIXME: obsolete done = 0; i = 0; if(level_subsets.num_items != 0) @@ -278,8 +281,7 @@ quit = 1; break; case SDL_KEYDOWN: // key pressed - /* Keypress... */ - + // Keypress... key = event.key.keysym.sym; if(key == SDLK_LEFT) @@ -322,9 +324,14 @@ titletux.level_begin(); update_time = st_get_ticks(); break; - case 1: +#endif + case 0: + // Start Game, ie. goto the slots menu update_load_save_game_menu(load_game_menu, true); break; + case 1: + // Contrib Menu + break; case 3: done = 1; quit = leveleditor(1); @@ -343,7 +350,17 @@ } else if(current_menu == load_game_menu) { - process_save_load_game_menu(false); + if (process_load_game_menu()) + { + // reset tux + scroll_x = 0; + titletux.level_begin(); + update_time = st_get_ticks(); + } + } + else if(current_menu == contrib_menu) + { + } mouse_cursor->draw(); Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- worldmap.cpp 3 Apr 2004 13:31:14 -0000 1.18 +++ worldmap.cpp 10 Apr 2004 18:56:17 -0000 1.19 @@ -105,8 +105,8 @@ texture_load(&sprite, datadir + "/images/worldmap/tux.png", USE_ALPHA); offset = 0; moving = false; - tile_pos.x = 0; - tile_pos.y = 0; + tile_pos.x = 5; + tile_pos.y = 5; direction = NONE; input_direction = NONE; } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- gameloop.cpp 9 Apr 2004 02:19:09 -0000 1.42 +++ gameloop.cpp 10 Apr 2004 18:56:17 -0000 1.43 @@ -701,11 +701,11 @@ } else if(current_menu == save_game_menu ) { - process_save_load_game_menu(true); + process_save_game_menu(); } else if(current_menu == load_game_menu ) { - process_save_load_game_menu(false); + process_load_game_menu(); } } @@ -1619,7 +1619,7 @@ } -void slotinfo(char **pinfo, int slot) +std::string slotinfo(int slot) { FILE* fi; char slotfile[1024]; @@ -1648,7 +1648,6 @@ fclose(fi); } - *pinfo = (char*) malloc(sizeof(char) * (strlen(tmp)+1)); - strcpy(*pinfo,tmp); + return tmp; } |
From: Ingo R. <gr...@us...> - 2004-04-10 19:08:03
|
Update of /cvsroot/super-tux/supertux/data/images/worldmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29200 Modified Files: antarctica.stwt Log Message: - fixed tile properties Index: antarctica.stwt =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/worldmap/antarctica.stwt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- antarctica.stwt 1 Apr 2004 20:22:28 -0000 1.3 +++ antarctica.stwt 10 Apr 2004 18:54:27 -0000 1.4 @@ -116,19 +116,81 @@ (tile (id 36) (image "wood13.png")) - (tile (id 37) (image "road_ne.png")) - (tile (id 38) (image "road_nsw.png")) - (tile (id 39) (image "road_sw.png")) - (tile (id 40) (image "road_we.png")) - (tile (id 41) (image "road_nes.png")) - (tile (id 42) (image "road_nw.png")) - (tile (id 43) (image "road_swe.png")) - (tile (id 44) (image "road_new.png")) - (tile (id 45) (image "road_nesw.png")) - (tile (id 46) (image "road_nws.png")) - (tile (id 47) (image "road_ns.png")) - (tile (id 48) (image "road_se.png")) + (tile (id 37) + (image "road_ne.png") + (north #t) + (south #f) + (west #f) + (east #t)) -) + (tile (id 38) + (image "road_nsw.png") + (north #t) + (south #t) + (west #t) + (east #f)) + (tile (id 39) + (image "road_sw.png") + (north #f) + (south #t) + (west #t) + (east #f)) + (tile (id 40) + (image "road_we.png") + (north #f) + (south #f) + (west #t) + (east #t) + (stop #f)) + (tile (id 41) + (image "road_nes.png") + (north #t) + (south #t) + (west #f) + (east #t)) + (tile (id 42) + (image "road_nw.png") + (north #t) + (south #f) + (west #t) + (east #f)) + (tile (id 43) + (image "road_swe.png") + (north #f) + (south #t) + (west #t) + (east #t)) + (tile (id 44) + (image "road_new.png") + (north #t) + (south #f) + (west #t) + (east #t)) + (tile (id 45) + (image "road_nesw.png") + (north #t) + (south #t) + (west #t) + (east #t)) + (tile (id 46) + (image "road_nws.png") + (north #t) + (south #t) + (west #t) + (east #f)) + (tile (id 47) + (image "road_ns.png") + (north #t) + (south #t) + (west #f) + (east #f) + (stop #f)) + (tile (id 48) + (image "road_se.png") + (north #f) + (south #t) + (west #f) + (east #t)) + ) ;; EOF ;; |
From: Ingo R. <gr...@us...> - 2004-04-10 15:07:13
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19902 Modified Files: menu.cpp menu.h setup.cpp title.cpp Log Message: removed title from main menu Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- menu.cpp 9 Apr 2004 02:19:09 -0000 1.24 +++ menu.cpp 10 Apr 2004 14:53:42 -0000 1.25 @@ -293,7 +293,6 @@ } } -/* Check, if the value of the active menu item has changed. */ int Menu::check() { Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- title.cpp 10 Apr 2004 11:56:19 -0000 1.22 +++ title.cpp 10 Apr 2004 14:53:43 -0000 1.23 @@ -245,7 +245,7 @@ { switch (main_menu->check()) { - case 2: + case 0: done = 0; i = 0; if(level_subsets.num_items != 0) @@ -322,17 +322,17 @@ titletux.level_begin(); update_time = st_get_ticks(); break; - case 3: + case 1: update_load_save_game_menu(load_game_menu, true); break; - case 5: + case 3: done = 1; quit = leveleditor(1); break; - case 6: + case 4: display_credits(); break; - case 7: + case 5: quit = 1; break; } Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- setup.cpp 9 Apr 2004 00:49:47 -0000 1.23 +++ setup.cpp 10 Apr 2004 14:53:43 -0000 1.24 @@ -359,16 +359,13 @@ game_menu = new Menu(); highscore_menu = new Menu(); - main_menu->set_pos(screen->w/2, 350); - main_menu->additem(MN_LABEL,"Main Menu",0,0); - main_menu->additem(MN_HL,"",0,0); + main_menu->set_pos(screen->w/2, 335); main_menu->additem(MN_ACTION,"Start Game",0,0); main_menu->additem(MN_GOTO,"Load Game",0,load_game_menu); main_menu->additem(MN_GOTO,"Options",0,options_menu); main_menu->additem(MN_ACTION,"Level editor",0,0); main_menu->additem(MN_ACTION,"Credits",0,0); main_menu->additem(MN_ACTION,"Quit",0,0); - main_menu->additem(MN_HL,"",0,0); options_menu->additem(MN_LABEL,"Options",0,0); options_menu->additem(MN_HL,"",0,0); Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- menu.h 3 Apr 2004 13:31:14 -0000 1.25 +++ menu.h 10 Apr 2004 14:53:43 -0000 1.26 @@ -79,6 +79,8 @@ void additem(menu_item_type* pmenu_item); void additem(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu); void action (); + + /** Check, if the value of the active menu item has changed. */ int check (); void draw (); void draw_item(int index, int menu_width, int menu_height); |
From: Ingo R. <gr...@us...> - 2004-04-10 13:00:44
|
Update of /cvsroot/super-tux/supertux/data/images/tilesets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31322 Modified Files: supertux.stgt Log Message: - fixed water/fish Index: supertux.stgt =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/tilesets/supertux.stgt,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- supertux.stgt 10 Apr 2004 12:41:26 -0000 1.13 +++ supertux.stgt 10 Apr 2004 12:47:16 -0000 1.14 @@ -234,9 +234,11 @@ (solid #t)) (tile (id 75) - (images "water.png")) + (images "water.png") + (water #t)) (tile (id 76) (images "waves-0.png" "waves-1.png" "waves-2.png") + (water #t) (anim-speed 25)) ;; Normal brick |
From: Ingo R. <gr...@us...> - 2004-04-10 12:57:44
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30831 Added Files: enemytest.stl Log Message: - test level for badguys --- NEW FILE: enemytest.stl --- ;; Generated by Windstille Editor (supertux-level (version 1) (name "Hello World") (width 50) (height 15) (background "") (music "Mortimers_chipdisko.mod") (bkgd_red 150) (bkgd_green 200) (bkgd_blue 255) (time 500) (gravity 10) (particle_system "") (theme "antarctica") (interactive-tm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 28 28 28 28 28 28 28 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 48 0 0 48 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 48 48 48 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 48 0 0 0 48 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 8 8 8 8 48 0 0 0 0 7 8 8 48 76 76 76 48 8 8 8 8 8 8 48 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 28 28 28 28 28 28 28 28 28 28 28 28 28 28 48 75 75 75 48 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 10 11 11 11 11 11 11 11 11 11 11 11 11 11 48 48 48 48 48 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ) (background-tm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) (foreground-tm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) (objects (fish (x 509) (y 281)) (flyingsnowball (x 941) (y 222)) (spiky (x 656) (y 306)) (snowball (x 259) (y 303)) (stalactite (x 1159) (y 288)) (stalactite (x 1235) (y 288)) (laptop (x 1198) (y 186)) (mriceblock (x 323) (y 74)) ) ) ;; EOF ;; |
From: Ingo R. <gr...@us...> - 2004-04-10 12:56:11
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30556 Added Files: exittest.stl Log Message: - added test level for exits --- NEW FILE: exittest.stl --- ;; Generated by Flexlay Editor (supertux-level (version 1) (name "Hello World") (width 100) (height 15) (background "") (music "Mortimers_chipdisko.mod") (bkgd_red 150) (bkgd_green 200) (bkgd_blue 255) (time 500) (gravity 10) (particle_system "") (theme "antarctica") (interactive-tm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 126 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 48 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 48 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 0 0 0 0 0 8 8 8 48 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ) (background-tm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 126 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 8 8 8 8 8 8 8 8 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) (foreground-tm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14 14 14 14 14 14 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) (objects ) ) ;; EOF ;; |
From: Ingo R. <gr...@us...> - 2004-04-10 12:55:37
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30488/test Log Message: Directory /cvsroot/super-tux/supertux/data/levels/test added to the repository |
From: Ingo R. <gr...@us...> - 2004-04-10 12:54:54
|
Update of /cvsroot/super-tux/supertux/data/images/tilesets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30340 Modified Files: supertux.stgt Added Files: exitbg.png exitfg.png Log Message: - added iglo for level end sequence --- NEW FILE: exitfg.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: exitbg.png --- (This appears to be a binary file; contents omitted.) Index: supertux.stgt =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/tilesets/supertux.stgt,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- supertux.stgt 3 Apr 2004 13:31:38 -0000 1.12 +++ supertux.stgt 10 Apr 2004 12:41:26 -0000 1.13 @@ -399,4 +399,12 @@ (tile (id 125) (images "snowbg4.png") (solid #t)) - ) \ No newline at end of file + + (tile (id 126) + (images "exitbg.png") + (solid #f)) + (tile (id 127) + (images "exitfg.png") + (solid #f)) + ) + |
From: Ingo R. <gr...@us...> - 2004-04-10 12:10:02
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23205 Modified Files: title.cpp Log Message: - fixed quit Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- title.cpp 10 Apr 2004 11:48:16 -0000 1.21 +++ title.cpp 10 Apr 2004 11:56:19 -0000 1.22 @@ -332,7 +332,7 @@ case 6: display_credits(); break; - case 8: + case 7: quit = 1; break; } |
From: Ingo R. <gr...@us...> - 2004-04-10 12:02:00
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21978 Modified Files: title.cpp Log Message: - fixed menu/logo overdraw problem Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- title.cpp 10 Apr 2004 11:42:43 -0000 1.20 +++ title.cpp 10 Apr 2004 11:48:16 -0000 1.21 @@ -217,7 +217,10 @@ /* Draw the background: */ draw_background(); draw_demo(); - texture_draw(&logo, 160, 30); + + if (current_menu == main_menu) + texture_draw(&logo, 160, 30); + text_draw(&white_small_text, " SuperTux " VERSION "\n" "Copyright (c) 2003 SuperTux Devel Team\n" |
From: Ingo R. <gr...@us...> - 2004-04-10 11:56:19
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21143/src Modified Files: badguy.cpp badguy.h title.cpp Log Message: - introduced mriceblock (at least a bit) - made title screen wrap-around seamlessly Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- badguy.h 4 Apr 2004 00:32:10 -0000 1.20 +++ badguy.h 10 Apr 2004 11:42:43 -0000 1.21 @@ -23,7 +23,7 @@ extern texture_type img_bsod_left[4]; extern texture_type img_bsod_right[4]; -extern texture_type img_laptop_left[3]; +extern texture_type img_laptop_left[4]; extern texture_type img_money_left[2]; /* Enemy modes: */ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- badguy.cpp 9 Apr 2004 16:25:17 -0000 1.20 +++ badguy.cpp 10 Apr 2004 11:42:43 -0000 1.21 @@ -28,8 +28,8 @@ texture_type img_laptop_falling_right[1]; texture_type img_bsod_left[4]; texture_type img_bsod_right[4]; -texture_type img_laptop_left[3]; -texture_type img_laptop_right[3]; +texture_type img_laptop_left[4]; +texture_type img_laptop_right[4]; texture_type img_money_left[2]; texture_type img_money_right[2]; texture_type img_mrbomb_left[4]; @@ -57,7 +57,7 @@ { if (str == "money") return BAD_MONEY; - else if (str == "laptop") + else if (str == "laptop" || str == "mriceblock") return BAD_LAPTOP; else if (str == "bsod") return BAD_BSOD; @@ -157,7 +157,7 @@ set_texture(img_mrbomb_left, img_mrbomb_right, 4); } else if (kind == BAD_LAPTOP) { physic.set_velocity(-1.3, 0); - set_texture(img_laptop_left, img_laptop_right, 3); + set_texture(img_laptop_left, img_laptop_right, 4, 5); } else if(kind == BAD_MONEY) { set_texture(img_money_left, img_money_right, 1); } else if(kind == BAD_BOMB) { @@ -296,7 +296,7 @@ if(!timer_check(&timer)) { mode = NORMAL; - set_texture(img_laptop_left, img_laptop_right, 3); + set_texture(img_laptop_left, img_laptop_right, 4, 5); physic.set_velocity( (dir == LEFT) ? -1.3 : 1.3, 0); } } @@ -986,32 +986,18 @@ /* (Laptop) */ - texture_load(&img_laptop_left[0], datadir + - "/images/shared/laptop-left-0.png", - USE_ALPHA); - - texture_load(&img_laptop_left[1], datadir + - "/images/shared/laptop-left-1.png", - USE_ALPHA); - - texture_load(&img_laptop_left[2], datadir + - "/images/shared/laptop-left-2.png", - USE_ALPHA); - - texture_load(&img_laptop_right[0], datadir + - "/images/shared/laptop-right-0.png", - USE_ALPHA); - - texture_load(&img_laptop_right[1], datadir + - "/images/shared/laptop-right-1.png", - USE_ALPHA); - - texture_load(&img_laptop_right[2], datadir + - "/images/shared/laptop-right-2.png", - USE_ALPHA); + texture_load(&img_laptop_left[0], datadir + "/images/shared/mriceblock-left-0.png", USE_ALPHA); + texture_load(&img_laptop_left[1], datadir + "/images/shared/mriceblock-left-1.png", USE_ALPHA); + texture_load(&img_laptop_left[2], datadir + "/images/shared/mriceblock-left-2.png", USE_ALPHA); + texture_load(&img_laptop_left[3], datadir + "/images/shared/mriceblock-left-1.png", USE_ALPHA); - texture_load(&img_laptop_flat_left[0], datadir + - "/images/shared/laptop-flat-left.png", + texture_load(&img_laptop_right[0], datadir + "/images/shared/mriceblock-right-0.png", USE_ALPHA); + texture_load(&img_laptop_right[1], datadir + "/images/shared/mriceblock-right-1.png", USE_ALPHA); + texture_load(&img_laptop_right[2], datadir + "/images/shared/mriceblock-right-2.png", USE_ALPHA); + texture_load(&img_laptop_right[3], datadir + "/images/shared/mriceblock-right-1.png", USE_ALPHA); + + texture_load(&img_laptop_flat_left[0], + datadir + "/images/shared/laptop-flat-left.png", USE_ALPHA); texture_load(&img_laptop_flat_right[0], datadir + @@ -1144,7 +1130,7 @@ texture_free(&img_bsod_falling_left[0]); texture_free(&img_bsod_falling_right[0]); - for (int i = 0; i < 3; i++) + for (int i = 0; i < 4; i++) { texture_free(&img_laptop_left[i]); texture_free(&img_laptop_right[i]); Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- title.cpp 9 Apr 2004 01:15:31 -0000 1.19 +++ title.cpp 10 Apr 2004 11:42:43 -0000 1.20 @@ -107,14 +107,22 @@ timer_start(&random_timer, rand() % 3000 + 3000); walking = !walking; } - + + // Wrap around at the end of the level back to the beginnig if(current_level.width * 32 - 320 < titletux.base.x) { - titletux.base.x = 160; - scroll_x = 0; + titletux.base.x = titletux.base.x - (current_level.width * 32 - 640); + scroll_x = titletux.base.x - 320; } + float last_tux_x_pos = titletux.base.x; titletux.action(); + + // Jump if tux stays in the same position for one loop, ie. if he is + // stuck behind a wall + if (last_tux_x_pos == titletux.base.x) + walking = false; + titletux.draw(); /* DEMO end */ |
From: Tobias Gl??er <to...@us...> - 2004-04-10 10:06:50
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1611/data/music Modified Files: fortress-fast.mod fortress.mod Log Message: update Index: fortress-fast.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/fortress-fast.mod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsJgpmen and /tmp/cvsK1KPn7 differ Index: fortress.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/fortress.mod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsaVLwDX and /tmp/cvsypkk8H differ |
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25222 Modified Files: snowball-left-0.png snowball-left-1.png snowball-left-2.png snowball-right-0.png snowball-right-1.png snowball-right-2.png Log Message: - fixed snowball anim Index: snowball-right-2.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/snowball-right-2.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsKIPjzb and /tmp/cvsFErFb6 differ Index: snowball-right-1.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/snowball-right-1.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsJuIuA9 and /tmp/cvsd2WLh4 differ Index: snowball-right-0.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/snowball-right-0.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvs8PYxdh and /tmp/cvsobXQZb differ Index: snowball-left-2.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/snowball-left-2.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvs8vTZlo and /tmp/cvsC2TTcj differ Index: snowball-left-1.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/snowball-left-1.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsdNmYyv and /tmp/cvsk8iCuq differ Index: snowball-left-0.png =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/shared/snowball-left-0.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsfyTraD and /tmp/cvsnnMv9x differ |
From: Ingo R. <gr...@us...> - 2004-04-09 16:38:38
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25081 Modified Files: badguy.cpp player.cpp Log Message: - fixed snowball anim Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- player.cpp 9 Apr 2004 02:19:09 -0000 1.20 +++ player.cpp 9 Apr 2004 16:25:17 -0000 1.21 @@ -602,7 +602,7 @@ if (!got_coffee) { - if (physic.get_velocity_y() > 0) + if (physic.get_velocity_y() != 0) { if (dir == RIGHT) texture_draw(&smalltux_jump_right, base.x - scroll_x, base.y - 10); Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- badguy.cpp 4 Apr 2004 00:32:10 -0000 1.19 +++ badguy.cpp 9 Apr 2004 16:25:17 -0000 1.20 @@ -48,8 +48,8 @@ texture_type img_flyingsnowball_squished[1]; texture_type img_spiky_left[3]; texture_type img_spiky_right[3]; -texture_type img_snowball_left[3]; -texture_type img_snowball_right[3]; +texture_type img_snowball_left[4]; +texture_type img_snowball_right[4]; texture_type img_snowball_squished_left[1]; texture_type img_snowball_squished_right[1]; @@ -178,14 +178,14 @@ set_texture(img_fish, img_fish, 2, 1); physic.enable_gravity(true); } else if(kind == BAD_FLYINGSNOWBALL) { - set_texture(img_flyingsnowball, img_flyingsnowball, 2); + set_texture(img_flyingsnowball, img_flyingsnowball, 2, 5); physic.enable_gravity(false); } else if(kind == BAD_SPIKY) { physic.set_velocity(-1.3, 0); set_texture(img_spiky_left, img_spiky_right, 3); } else if(kind == BAD_SNOWBALL) { physic.set_velocity(-1.3, 0); - set_texture(img_snowball_left, img_snowball_right, 3); + set_texture(img_snowball_left, img_snowball_right, 4, 5); } // if we're in a solid tile at start correct that now @@ -1114,16 +1114,16 @@ } /** snowball */ - for(int i = 0; i < 3; ++i) { - char num[4]; - snprintf(num, 4, "%d", i); - texture_load(&img_snowball_left[i], - datadir + "/images/shared/snowball-left-" + num + ".png", - USE_ALPHA); - texture_load(&img_snowball_right[i], - datadir + "/images/shared/snowball-right-" + num + ".png", - USE_ALPHA); - } + texture_load(&img_snowball_left[0], datadir + "/images/shared/snowball-left-0.png", USE_ALPHA); + texture_load(&img_snowball_left[1], datadir + "/images/shared/snowball-left-1.png", USE_ALPHA); + texture_load(&img_snowball_left[2], datadir + "/images/shared/snowball-left-2.png", USE_ALPHA); + texture_load(&img_snowball_left[3], datadir + "/images/shared/snowball-left-1.png", USE_ALPHA); + + texture_load(&img_snowball_right[0], datadir + "/images/shared/snowball-right-0.png", USE_ALPHA); + texture_load(&img_snowball_right[1], datadir + "/images/shared/snowball-right-1.png", USE_ALPHA); + texture_load(&img_snowball_right[2], datadir + "/images/shared/snowball-right-2.png", USE_ALPHA); + texture_load(&img_snowball_right[3], datadir + "/images/shared/snowball-right-1.png", USE_ALPHA); + texture_load(&img_snowball_squished_left[0], datadir + "/images/shared/bsod-squished-left.png", USE_ALPHA); texture_load(&img_snowball_squished_right[0], @@ -1194,7 +1194,7 @@ texture_free(&img_spiky_left[i]); texture_free(&img_spiky_right[i]); } - for(int i = 0; i<3; ++i) { + for(int i = 0; i<4; ++i) { texture_free(&img_snowball_left[i]); texture_free(&img_snowball_right[i]); } |