4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 BouncyDistro::init(float x, float y)
36 BouncyDistro::action(double frame_ratio)
38 base.y = base.y + base.ym * frame_ratio;
40 base.ym += 0.1 * frame_ratio;
43 World::current()->bouncy_distros.erase(static_cast<std::vector<BouncyDistro>::iterator>(this));
49 img_distro[0]->draw(base.x - scroll_x,
55 BrokenBrick::init(Tile* tile_, float x, float y, float xm, float ym)
68 BrokenBrick::action(double frame_ratio)
70 base.x = base.x + base.xm * frame_ratio;
71 base.y = base.y + base.ym * frame_ratio;
74 World::current()->broken_bricks.erase(static_cast<std::vector<BrokenBrick>::iterator>(this));
86 dest.x = (int)(base.x - scroll_x);
91 if (tile->images.size() > 0)
92 tile->images[0]->draw_part(src.x,src.y,dest.x,dest.y,dest.w,dest.h);
96 BouncyBrick::init(float x, float y)
101 offset_m = -BOUNCY_BRICK_SPEED;
102 shape = World::current()->get_level()->gettileid(x, y);
106 BouncyBrick::action(double frame_ratio)
108 offset = (offset + offset_m * frame_ratio);
111 if (offset < -BOUNCY_BRICK_MAX_OFFSET)
112 offset_m = BOUNCY_BRICK_SPEED;
117 World::current()->bouncy_bricks.erase(static_cast<std::vector<BouncyBrick>::iterator>(this));
126 if (base.x >= scroll_x - 32 &&
127 base.x <= scroll_x + screen->w)
129 dest.x = (int)(base.x - scroll_x);
130 dest.y = (int)base.y;
134 Level* plevel = World::current()->get_level();
136 // FIXME: overdrawing hack to clean the tile from the screen to
137 // paint it later at on offseted position
138 if(plevel->bkgd_image[0] == '\0')
140 fillrect(base.x - scroll_x, base.y,
142 plevel->bkgd_top.red, plevel->bkgd_top.green, plevel->bkgd_top.blue, 0);
143 // FIXME: doesn't respect the gradient, futhermore is this necessary at all??
147 s = (int)scroll_x / 30;
148 plevel->img_bkgd->draw_part(dest.x + s, dest.y,
149 dest.x, dest.y,dest.w,dest.h);
152 Tile::draw(base.x - scroll_x,
159 FloatingScore::init(float x, float y, int s)
169 FloatingScore::action(double frame_ratio)
171 base.y = base.y - 2 * frame_ratio;
174 World::current()->floating_scores.erase(static_cast<std::vector<FloatingScore>::iterator>(this));
178 FloatingScore::draw()
181 sprintf(str, "%d", value);
182 gold_text->draw(str, (int)base.x + 16 - strlen(str) * 8, (int)base.y, 1);