From: Ricardo Cruz Date: Fri, 14 May 2004 16:02:41 +0000 (+0000) Subject: First try to switch to 800x600. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ec3eb0daf947b240793c422fae4735466d31ed8b;p=supertux.git First try to switch to 800x600. Unfortanely, the game crashes when drawing the tiles. I committed this in the hope that somebody fixes it. :D SVN-Revision: 1178 --- diff --git a/src/defines.h b/src/defines.h index 3079638f2..688266f6b 100644 --- a/src/defines.h +++ b/src/defines.h @@ -48,6 +48,11 @@ enum DyingType { DYING_FALLING = 2 }; +/* Screen-related stuff */ + +#define VISIBLE_TILES_X 25 +#define VISIBLE_TILES_Y 19 + /* Sizes: */ #define SMALL 0 diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index 80949a97a..44c01e99d 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -952,8 +952,8 @@ void le_drawlevel() /* clearscreen(current_level.bkgd_red, current_level.bkgd_green, current_level.bkgd_blue); */ - for (y = 0; y < 16 && y < (unsigned)le_world->get_level()->height; ++y) - for (x = 0; x < 20; ++x) + for (y = 0; y < VISIBLE_TILES_Y && y < (unsigned)le_world->get_level()->height; ++y) + for (x = 0; x < (unsigned)VISIBLE_TILES_X-80; ++x) { if(active_tm == TM_BG) diff --git a/src/setup.cpp b/src/setup.cpp index af5a9644f..af8200987 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -64,8 +64,8 @@ /* Screen proprities: */ /* Don't use this to test for the actual screen sizes. Use screen->w/h instead! */ -#define SCREEN_W 640 -#define SCREEN_H 480 +#define SCREEN_W 800 +#define SCREEN_H 600 /* Local function prototypes: */ diff --git a/src/tile.cpp b/src/tile.cpp index 116f18529..06f684823 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -185,6 +185,8 @@ void TileManager::load_tileset(std::string filename) void Tile::draw(float x, float y, unsigned int c, Uint8 alpha) { +fprintf(stderr, "x: %i\n", x); +fprintf(stderr, "y: %i\n", y); if (c != 0) { Tile* ptile = TileManager::instance()->get(c); diff --git a/src/world.cpp b/src/world.cpp index 7728a2d9a..f251e3d74 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -196,20 +196,25 @@ World::draw() (*p)->draw(scroll_x, 0, 0); } +fprintf(stderr, "level->height: %i\n", level->height); +fprintf(stderr, "scroll_x: %i\n", scroll_x); +fprintf(stderr, "scroll_y: %i\n", scroll_y); /* Draw background: */ - for (y = 0; y < 16 && y < level->height; ++y) + for (y = 0; y < VISIBLE_TILES_Y && y < level->height; ++y) { - for (x = 0; x < 21; ++x) +fprintf(stderr, "drawing row: %i\n", y); + for (x = 0; x < VISIBLE_TILES_X; ++x) { +fprintf(stderr, "x: %i\n", x); Tile::draw(32*x - fmodf(scroll_x, 32), y * 32 - fmodf(scroll_y, 32), level->bg_tiles[(int)y + (int)(scroll_y / 32)][(int)x + (int)(scroll_x / 32)]); } } /* Draw interactive tiles: */ - for (y = 0; y < 16 && y < level->height; ++y) + for (y = 0; y < VISIBLE_TILES_Y && y < level->height; ++y) { - for (x = 0; x < 21; ++x) + for (x = 0; x < VISIBLE_TILES_X; ++x) { Tile::draw(32*x - fmodf(scroll_x, 32), y * 32 - fmodf(scroll_y, 32), level->ia_tiles[(int)y + (int)(scroll_y / 32)][(int)x + (int)(scroll_x / 32)]); @@ -241,9 +246,9 @@ World::draw() broken_bricks[i]->draw(); /* Draw foreground: */ - for (y = 0; y < 16 && y < level->height; ++y) + for (y = 0; y < VISIBLE_TILES_Y && y < level->height; ++y) { - for (x = 0; x < 21; ++x) + for (x = 0; x < VISIBLE_TILES_X; ++x) { Tile::draw(32*x - fmodf(scroll_x, 32), y * 32 - fmodf(scroll_y, 32), level->fg_tiles[(int)y + (int)(scroll_y / 32)][(int)x + (int)(scroll_x / 32)]); @@ -312,10 +317,10 @@ World::action(double frame_ratio) /* the space that it takes for the screen to start scrolling, regarding */ /* screen bounds (in pixels) */ -// should be higher than screen->w/2 (320) -#define X_SPACE (400-16) -// should be less than screen->h/2 (240) -#define Y_SPACE 200 +// should be higher than screen->w/2 (400) +#define X_SPACE (500-16) +// should be less than screen->h/2 (300) +#define Y_SPACE 250 // the time it takes to move the camera (in ms) #define CHANGE_DIR_SCROLL_SPEED 2000