Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3111/src
Modified Files:
gameloop.cpp level.cpp leveleditor.cpp
Log Message:
Level's draw_bg() now takes full care of the background drawing.
Index: level.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- level.cpp 18 May 2004 14:03:53 -0000 1.78
+++ level.cpp 19 May 2004 10:29:39 -0000 1.79
@@ -762,14 +762,21 @@
void Level::draw_bg()
{
- // Tile background horizontally
- int sx = (int)((float)scroll_x * ((float)bkgd_speed/100.0f)) % img_bkgd->w;
- int sy = (int)((float)scroll_y * ((float)bkgd_speed/100.0f)) % img_bkgd->h;
- for (int x = 0; (x-1)*img_bkgd->w <= screen->w; x++)
- for (int y = 0; (y-1)*img_bkgd->h <= screen->h; y++)
- img_bkgd->draw_part(x == 0 ? sx : 0, y == 0 ? sy : 0,
- x == 0 ? 0 : (img_bkgd->w * x) - sx, y == 0 ? 0 : (img_bkgd->h * y) - sy,
- x == 0 ? img_bkgd->w - sx : img_bkgd->w, y == 0 ? img_bkgd->h - sy : img_bkgd->h);
+ if(img_bkgd)
+ {
+ // Tile background horizontally
+ int sx = (int)((float)scroll_x * ((float)bkgd_speed/100.0f)) % img_bkgd->w;
+ int sy = (int)((float)scroll_y * ((float)bkgd_speed/100.0f)) % img_bkgd->h;
+ for (int x = 0; (x-1)*img_bkgd->w <= screen->w; x++)
+ for (int y = 0; (y-1)*img_bkgd->h <= screen->h; y++)
+ img_bkgd->draw_part(x == 0 ? sx : 0, y == 0 ? sy : 0,
+ x == 0 ? 0 : (img_bkgd->w * x) - sx, y == 0 ? 0 : (img_bkgd->h * y) - sy,
+ x == 0 ? img_bkgd->w - sx : img_bkgd->w, y == 0 ? img_bkgd->h - sy : img_bkgd->h);
+ }
+ else
+ {
+ drawgradient(bkgd_top, bkgd_bottom);
+ }
}
void
Index: gameloop.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- gameloop.cpp 18 May 2004 14:02:47 -0000 1.132
+++ gameloop.cpp 19 May 2004 10:29:39 -0000 1.133
@@ -145,10 +145,7 @@
char str[60];
- if (get_level()->img_bkgd)
- get_level()->draw_bg();
- else
- drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom);
+ get_level()->draw_bg();
sprintf(str, "%s", world->get_level()->name.c_str());
gold_text->drawf(str, 0, 220, A_HMIDDLE, A_TOP, 1);
@@ -719,10 +716,7 @@
{
char str[80];
- if (get_level()->img_bkgd)
- get_level()->draw_bg();
- else
- drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom);
+ get_level()->draw_bg();
blue_text->drawf("Result:", 0, 200, A_HMIDDLE, A_TOP, 1);
Index: leveleditor.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- leveleditor.cpp 15 May 2004 18:26:48 -0000 1.120
+++ leveleditor.cpp 19 May 2004 10:29:39 -0000 1.121
@@ -927,10 +927,7 @@
Uint8 a;
/* Draw the real background */
- if (le_world->get_level()->img_bkgd)
- le_world->get_level()->draw_bg();
- else
- drawgradient(le_world->get_level()->bkgd_top, le_world->get_level()->bkgd_bottom);
+ le_world->get_level()->draw_bg();
if(le_current.IsTile())
{
|