(sprite (name "largetux-walk-left")
+ (x-hotspot 6)
+ (y-hotspot 2)
(images "shared/largetux-walk-left-0.png"
"shared/largetux-walk-left-1.png"
"shared/largetux-walk-left-2.png"
"shared/largetux-walk-left-5.png"))
(sprite (name "largetux-walk-right")
+ (x-hotspot 6)
+ (y-hotspot 2)
(images "shared/largetux-walk-right-0.png"
"shared/largetux-walk-right-1.png"
"shared/largetux-walk-right-2.png"
"shared/largetux-walk-right-5.png"))
(sprite (name "largetux-jump-left")
+ (x-hotspot 9)
+ (y-hotspot 2)
(images "shared/largetux-jump-left-0.png"))
-
(sprite (name "largetux-jump-right")
+ (x-hotspot 9)
+ (y-hotspot 2)
(images "shared/largetux-jump-right-0.png"))
+
+ (sprite (name "largetux-duck-left")
+ (x-hotspot 6)
+ (y-hotspot 2)
+ (images "shared/tux-duck-left.png"))
+ (sprite (name "largetux-duck-right")
+ (x-hotspot 6)
+ (y-hotspot 6)
+ (images "shared/tux-duck-right.png"))
)
;; EOF ;;
reader.read_int("version", &version);
reader.read_int("width", &width);
reader.read_int("time", &time_left);
+
reader.read_int("bkgd_top_red", &bkgd_top.red);
reader.read_int("bkgd_top_green", &bkgd_top.green);
reader.read_int("bkgd_top_blue", &bkgd_top.blue);
+
reader.read_int("bkgd_bottom_red", &bkgd_bottom.red);
reader.read_int("bkgd_bottom_green", &bkgd_bottom.green);
reader.read_int("bkgd_bottom_blue", &bkgd_bottom.blue);
+
reader.read_float("gravity", &gravity);
reader.read_string("name", &name);
reader.read_string("author", &author);
*ptexture = new Surface(fname, use_alpha);
}
-void tilemap_change_size(unsigned int** tilemap[15], int w, int old_w)
-{
- int j,y;
- for(y = 0; y < 15; ++y)
- {
- *tilemap[y] = (unsigned int*) realloc(*tilemap[y],(w+1)*sizeof(unsigned int));
- if(w > old_w)
- for(j = 0; j < w - old_w; ++j)
- *tilemap[y][old_w+j] = 0;
- *tilemap[y][w] = 0;
- }
-}
-
/* Change the size of a level (width) */
void
Level::change_size (int new_width)
if(new_width < 21)
new_width = 21;
- 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);
+ for(int y = 0; y < 15; ++y)
+ {
+ ia_tiles[y].resize(new_width, 0);
+ bg_tiles[y].resize(new_width, 0);
+ fg_tiles[y].resize(new_width, 0);
+ }
width = new_width;
}
Sprite* bigtux_left;
Sprite* bigtux_right_jump;
Sprite* bigtux_left_jump;
-Surface* ducktux_right;
-Surface* ducktux_left;
+Sprite* ducktux_right;
+Sprite* ducktux_left;
Surface* skidtux_right;
Surface* skidtux_left;
Surface* firetux_right[3];
/* Draw cape: */
if (dir == RIGHT)
- {
- cape_right[global_frame_counter % 2]->draw(base.x- scroll_x, base.y);
- }
+ cape_right[global_frame_counter % 2]->draw(base.x- scroll_x, base.y);
else
- {
- cape_left[global_frame_counter % 2]->draw(
- base.x- scroll_x, base.y);
- }
+ cape_left[global_frame_counter % 2]->draw(base.x- scroll_x, base.y);
}
else // moving
{
if (dir == RIGHT)
- tux_right[(global_frame_counter/2) % tux_right.size()]->draw(
- base.x - scroll_x, base.y - 9);
+ tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9);
else
- tux_left[(global_frame_counter/2) % tux_left.size()]->draw(
- base.x - scroll_x, base.y - 9);
+ tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9);
}
}
}
/* Draw cape (just not in ducked mode since that looks silly): */
if (dir == RIGHT)
- {
- bigcape_right[global_frame_counter % 2]->draw(
- capex, capey);
- }
+ bigcape_right[global_frame_counter % 2]->draw(capex, capey);
else
- {
- bigcape_left[global_frame_counter % 2]->draw(
- capex, capey);
- }
+ bigcape_left[global_frame_counter % 2]->draw(capex, capey);
}
if (!got_coffee)
if (physic.get_velocity_y() == 0)
{
if (dir == RIGHT)
- bigtux_right->draw(base.x- scroll_x - 8, base.y);
+ bigtux_right->draw(base.x - scroll_x, base.y);
else
- bigtux_left->draw(base.x- scroll_x - 8, base.y);
+ bigtux_left->draw(base.x - scroll_x, base.y);
}
else
{
if (dir == RIGHT)
- bigtux_right_jump->draw(base.x- scroll_x - 8, base.y);
+ bigtux_right_jump->draw(base.x - scroll_x, base.y);
else
- bigtux_left_jump->draw(base.x- scroll_x - 8, base.y);
+ bigtux_left_jump->draw(base.x - scroll_x, base.y);
}
}
else
{
if (dir == RIGHT)
- skidtux_right->draw(base.x- scroll_x - 8, base.y);
+ skidtux_right->draw(base.x - scroll_x - 8, base.y);
else
- skidtux_left->draw(base.x- scroll_x - 8, base.y);
+ skidtux_left->draw(base.x - scroll_x - 8, base.y);
}
}
else
{
if (dir == RIGHT)
- {
- ducktux_right->draw( base.x- scroll_x - 8, base.y - 16);
- }
+ ducktux_right->draw(base.x - scroll_x, base.y);
else
- {
- ducktux_left->draw( base.x- scroll_x - 8, base.y - 16);
- }
+ ducktux_left->draw(base.x - scroll_x, base.y);
}
}
else
if (!jumping || physic.get_velocity_y() > 0)
{
if (dir == RIGHT)
- {
- bigfiretux_right[frame_]->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigfiretux_right[frame_]->draw(base.x- scroll_x - 8, base.y);
else
- {
- bigfiretux_left[frame_]->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigfiretux_left[frame_]->draw(base.x- scroll_x - 8, base.y);
}
else
{
if (dir == RIGHT)
- {
- bigfiretux_right_jump->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigfiretux_right_jump->draw(base.x- scroll_x - 8, base.y);
else
- {
- bigfiretux_left_jump->draw(
- base.x- scroll_x - 8, base.y);
- }
+ bigfiretux_left_jump->draw(base.x- scroll_x - 8, base.y);
}
}
else
{
if (dir == RIGHT)
- {
- skidfiretux_right->draw(
- base.x- scroll_x - 8, base.y);
- }
+ skidfiretux_right->draw(base.x- scroll_x - 8, base.y);
else
- {
- skidfiretux_left->draw(
- base.x- scroll_x - 8, base.y);
- }
+ skidfiretux_left->draw(base.x- scroll_x - 8, base.y);
}
}
else
{
if (dir == RIGHT)
- {
- duckfiretux_right->draw( base.x- scroll_x - 8, base.y - 16);
- }
+ duckfiretux_right->draw( base.x- scroll_x - 8, base.y - 16);
else
- {
- duckfiretux_left->draw( base.x- scroll_x - 8, base.y - 16);
- }
+ duckfiretux_left->draw( base.x- scroll_x - 8, base.y - 16);
}
}
}