From: Christoph Sommer Date: Sat, 19 Jan 2008 15:22:49 +0000 (+0000) Subject: Started making Tux a single sprite again. Still missing: FireTux, IceTux X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=af79f0712f972a0730f8a0220f927b22d568a196;p=supertux.git Started making Tux a single sprite again. Still missing: FireTux, IceTux SVN-Revision: 5281 --- diff --git a/data/images/creatures/tux/big/backflip-0.png b/data/images/creatures/tux/big/backflip-0.png new file mode 100644 index 000000000..a3291d2e1 Binary files /dev/null and b/data/images/creatures/tux/big/backflip-0.png differ diff --git a/data/images/creatures/tux/big/backflip-1.png b/data/images/creatures/tux/big/backflip-1.png new file mode 100644 index 000000000..bd86934b7 Binary files /dev/null and b/data/images/creatures/tux/big/backflip-1.png differ diff --git a/data/images/creatures/tux/big/backflip-2.png b/data/images/creatures/tux/big/backflip-2.png new file mode 100644 index 000000000..7974fcab3 Binary files /dev/null and b/data/images/creatures/tux/big/backflip-2.png differ diff --git a/data/images/creatures/tux/big/backflip-3.png b/data/images/creatures/tux/big/backflip-3.png new file mode 100644 index 000000000..f3c6fecad Binary files /dev/null and b/data/images/creatures/tux/big/backflip-3.png differ diff --git a/data/images/creatures/tux/big/backflip-4.png b/data/images/creatures/tux/big/backflip-4.png new file mode 100644 index 000000000..9c21a7b51 Binary files /dev/null and b/data/images/creatures/tux/big/backflip-4.png differ diff --git a/data/images/creatures/tux/big/duck-0.png b/data/images/creatures/tux/big/duck-0.png new file mode 100644 index 000000000..2f4c9bbb5 Binary files /dev/null and b/data/images/creatures/tux/big/duck-0.png differ diff --git a/data/images/creatures/tux/big/idle-0.png b/data/images/creatures/tux/big/idle-0.png new file mode 100644 index 000000000..8b72f0d3a Binary files /dev/null and b/data/images/creatures/tux/big/idle-0.png differ diff --git a/data/images/creatures/tux/big/idle-1.png b/data/images/creatures/tux/big/idle-1.png new file mode 100644 index 000000000..65508b22e Binary files /dev/null and b/data/images/creatures/tux/big/idle-1.png differ diff --git a/data/images/creatures/tux/big/jump-0.png b/data/images/creatures/tux/big/jump-0.png new file mode 100644 index 000000000..e2ef7d29c Binary files /dev/null and b/data/images/creatures/tux/big/jump-0.png differ diff --git a/data/images/creatures/tux/big/kick-0.png b/data/images/creatures/tux/big/kick-0.png new file mode 100644 index 000000000..a494c7ecf Binary files /dev/null and b/data/images/creatures/tux/big/kick-0.png differ diff --git a/data/images/creatures/tux/big/skid-0.png b/data/images/creatures/tux/big/skid-0.png new file mode 100644 index 000000000..3b1d54a32 Binary files /dev/null and b/data/images/creatures/tux/big/skid-0.png differ diff --git a/data/images/creatures/tux/big/stand-0.png b/data/images/creatures/tux/big/stand-0.png new file mode 100644 index 000000000..ef6800c8a Binary files /dev/null and b/data/images/creatures/tux/big/stand-0.png differ diff --git a/data/images/creatures/tux/big/walk-0.png b/data/images/creatures/tux/big/walk-0.png new file mode 100644 index 000000000..0bd06aeb8 Binary files /dev/null and b/data/images/creatures/tux/big/walk-0.png differ diff --git a/data/images/creatures/tux/big/walk-1.png b/data/images/creatures/tux/big/walk-1.png new file mode 100644 index 000000000..50e22264e Binary files /dev/null and b/data/images/creatures/tux/big/walk-1.png differ diff --git a/data/images/creatures/tux/big/walk-2.png b/data/images/creatures/tux/big/walk-2.png new file mode 100644 index 000000000..0acc74dfe Binary files /dev/null and b/data/images/creatures/tux/big/walk-2.png differ diff --git a/data/images/creatures/tux/big/walk-3.png b/data/images/creatures/tux/big/walk-3.png new file mode 100644 index 000000000..991945074 Binary files /dev/null and b/data/images/creatures/tux/big/walk-3.png differ diff --git a/data/images/creatures/tux/big/walk-4.png b/data/images/creatures/tux/big/walk-4.png new file mode 100644 index 000000000..1a746c1ff Binary files /dev/null and b/data/images/creatures/tux/big/walk-4.png differ diff --git a/data/images/creatures/tux/big/walk-5.png b/data/images/creatures/tux/big/walk-5.png new file mode 100644 index 000000000..81396fbd3 Binary files /dev/null and b/data/images/creatures/tux/big/walk-5.png differ diff --git a/data/images/creatures/tux/small/gameover-0.png b/data/images/creatures/tux/small/gameover-0.png new file mode 100644 index 000000000..e0a990047 Binary files /dev/null and b/data/images/creatures/tux/small/gameover-0.png differ diff --git a/data/images/creatures/tux/small/gameover-1.png b/data/images/creatures/tux/small/gameover-1.png new file mode 100644 index 000000000..3a1bd9a5e Binary files /dev/null and b/data/images/creatures/tux/small/gameover-1.png differ diff --git a/data/images/creatures/tux/small/grow-0.png b/data/images/creatures/tux/small/grow-0.png new file mode 100644 index 000000000..26b7b58e7 Binary files /dev/null and b/data/images/creatures/tux/small/grow-0.png differ diff --git a/data/images/creatures/tux/small/grow-1.png b/data/images/creatures/tux/small/grow-1.png new file mode 100644 index 000000000..8f47e5d12 Binary files /dev/null and b/data/images/creatures/tux/small/grow-1.png differ diff --git a/data/images/creatures/tux/small/grow-2.png b/data/images/creatures/tux/small/grow-2.png new file mode 100644 index 000000000..9c3a7469b Binary files /dev/null and b/data/images/creatures/tux/small/grow-2.png differ diff --git a/data/images/creatures/tux/small/grow-3.png b/data/images/creatures/tux/small/grow-3.png new file mode 100644 index 000000000..c8d898185 Binary files /dev/null and b/data/images/creatures/tux/small/grow-3.png differ diff --git a/data/images/creatures/tux/small/grow-4.png b/data/images/creatures/tux/small/grow-4.png new file mode 100644 index 000000000..f26062598 Binary files /dev/null and b/data/images/creatures/tux/small/grow-4.png differ diff --git a/data/images/creatures/tux/small/grow-5.png b/data/images/creatures/tux/small/grow-5.png new file mode 100644 index 000000000..e88f67771 Binary files /dev/null and b/data/images/creatures/tux/small/grow-5.png differ diff --git a/data/images/creatures/tux/small/grow-6.png b/data/images/creatures/tux/small/grow-6.png new file mode 100644 index 000000000..8641e8f5a Binary files /dev/null and b/data/images/creatures/tux/small/grow-6.png differ diff --git a/data/images/creatures/tux/small/idle-0.png b/data/images/creatures/tux/small/idle-0.png new file mode 100644 index 000000000..0566b85ff Binary files /dev/null and b/data/images/creatures/tux/small/idle-0.png differ diff --git a/data/images/creatures/tux/small/idle-1.png b/data/images/creatures/tux/small/idle-1.png new file mode 100644 index 000000000..41d3769f6 Binary files /dev/null and b/data/images/creatures/tux/small/idle-1.png differ diff --git a/data/images/creatures/tux/small/jump-0.png b/data/images/creatures/tux/small/jump-0.png new file mode 100644 index 000000000..79b7989b4 Binary files /dev/null and b/data/images/creatures/tux/small/jump-0.png differ diff --git a/data/images/creatures/tux/small/kick-0.png b/data/images/creatures/tux/small/kick-0.png new file mode 100644 index 000000000..e2471500e Binary files /dev/null and b/data/images/creatures/tux/small/kick-0.png differ diff --git a/data/images/creatures/tux/small/skid-0.png b/data/images/creatures/tux/small/skid-0.png new file mode 100644 index 000000000..1acb83f37 Binary files /dev/null and b/data/images/creatures/tux/small/skid-0.png differ diff --git a/data/images/creatures/tux/small/stand-0.png b/data/images/creatures/tux/small/stand-0.png new file mode 100644 index 000000000..d52b04df2 Binary files /dev/null and b/data/images/creatures/tux/small/stand-0.png differ diff --git a/data/images/creatures/tux/small/walk-0.png b/data/images/creatures/tux/small/walk-0.png new file mode 100644 index 000000000..5d932e477 Binary files /dev/null and b/data/images/creatures/tux/small/walk-0.png differ diff --git a/data/images/creatures/tux/small/walk-1.png b/data/images/creatures/tux/small/walk-1.png new file mode 100644 index 000000000..b906ba83d Binary files /dev/null and b/data/images/creatures/tux/small/walk-1.png differ diff --git a/data/images/creatures/tux/small/walk-2.png b/data/images/creatures/tux/small/walk-2.png new file mode 100644 index 000000000..5157bb0f1 Binary files /dev/null and b/data/images/creatures/tux/small/walk-2.png differ diff --git a/data/images/creatures/tux/small/walk-3.png b/data/images/creatures/tux/small/walk-3.png new file mode 100644 index 000000000..06e8ca863 Binary files /dev/null and b/data/images/creatures/tux/small/walk-3.png differ diff --git a/data/images/creatures/tux/small/walk-4.png b/data/images/creatures/tux/small/walk-4.png new file mode 100644 index 000000000..9a796ee2d Binary files /dev/null and b/data/images/creatures/tux/small/walk-4.png differ diff --git a/data/images/creatures/tux/small/walk-5.png b/data/images/creatures/tux/small/walk-5.png new file mode 100644 index 000000000..d52b04df2 Binary files /dev/null and b/data/images/creatures/tux/small/walk-5.png differ diff --git a/data/images/creatures/tux/small/walk-6.png b/data/images/creatures/tux/small/walk-6.png new file mode 100644 index 000000000..860d34c57 Binary files /dev/null and b/data/images/creatures/tux/small/walk-6.png differ diff --git a/data/images/creatures/tux/small/walk-7.png b/data/images/creatures/tux/small/walk-7.png new file mode 100644 index 000000000..cfe55b360 Binary files /dev/null and b/data/images/creatures/tux/small/walk-7.png differ diff --git a/data/images/creatures/tux/tux.sprite b/data/images/creatures/tux/tux.sprite new file mode 100644 index 000000000..0dffcb7e6 --- /dev/null +++ b/data/images/creatures/tux/tux.sprite @@ -0,0 +1,215 @@ +(supertux-sprite + + (action + (name "gameover") + (fps 10.0) + (hitbox 13 6 32 32) + (images "small/gameover-0.png" + "small/gameover-1.png")) + + +; Small Tux + + (action + (name "small-walk-right") + (fps 15.0) + (hitbox 8 14 32 32) + (images "small/walk-0.png" + "small/walk-1.png" + "small/walk-2.png" + "small/walk-3.png" + "small/walk-4.png" + "small/walk-5.png" + "small/walk-6.png" + "small/walk-7.png")) + + (action + (name "small-walk-left") + (fps 15.0) + (hitbox 8 14 32 32) + (mirror-action "small-walk-right")) + + (action + (name "small-stand-right") + (fps 15.0) + (hitbox 8 14 32 32) + (images "small/stand-0.png")) + + (action + (name "small-stand-left") + (fps 15.0) + (hitbox 8 14 32 32) + (mirror-action "small-stand-right")) + + (action + (name "small-jump-right") + (fps 15.0) + (hitbox 8 14 32 32) + (images "small/jump-0.png")) + + (action + (name "small-jump-left") + (fps 15.0) + (hitbox 8 14 32 32) + (mirror-action "small-jump-right")) + + (action + (name "small-skid-right") + (hitbox 8 14 32 32) + (images "small/skid-0.png")) + + (action + (name "small-skid-left") + (hitbox 8 14 32 32) + (mirror-action "small-skid-right")) + + (action + (name "small-kick-right") + (hitbox 8 14 32 32) + (images "small/kick-0.png")) + + (action + (name "small-kick-left") + (hitbox 8 14 32 32) + (mirror-action "small-kick-right")) + + (action + (name "small-idle-right") + (fps 5.0) + (hitbox 8 14 32 32) + (images "small/idle-0.png" + "small/idle-1.png" + "small/idle-0.png")) + + (action + (name "small-idle-left") + (hitbox 8 14 32 32) + (mirror-action "small-idle-right")) + + (action + (name "grow-right") + (fps 5.0) + (hitbox 16 5 32 64) + (images "small/grow-0.png" + "small/grow-1.png" + "small/grow-2.png" + "small/grow-3.png" + "small/grow-4.png" + "small/grow-5.png" + "small/grow-6.png")) + + (action + (name "grow-left") + (hitbox 16 5 32 64) + (mirror-action "grow-right")) + + +; Big Tux + + (action + (name "big-walk-right") + (fps 15.0) + (hitbox 16 5 32 64) + (images "big/walk-0.png" + "big/walk-1.png" + "big/walk-2.png" + "big/walk-3.png" + "big/walk-4.png" + "big/walk-5.png")) + + (action + (name "big-walk-left") + (fps 15.0) + (hitbox 16 5 32 64) + (mirror-action "big-walk-right")) + + (action + (name "big-stand-right") + (fps 15.0) + (hitbox 16 5 32 64) + (images "big/stand-0.png")) + + (action + (name "big-stand-left") + (fps 15.0) + (hitbox 16 5 32 64) + (mirror-action "big-stand-right")) + + (action + (name "big-jump-right") + (fps 15.0) + (hitbox 16 5 32 64) + (images "big/jump-0.png")) + + (action + (name "big-jump-left") + (fps 15.0) + (hitbox 16 5 32 64) + (mirror-action "big-jump-right")) + + (action + (name "big-skid-right") + (hitbox 16 5 32 64) + (images "big/skid-0.png")) + + (action + (name "big-skid-left") + (hitbox 16 5 32 64) + (mirror-action "big-skid-right")) + + (action + (name "big-kick-right") + (hitbox 16 5 32 64) + (images "big/kick-0.png")) + + (action + (name "big-kick-left") + (hitbox 16 5 32 64) + (mirror-action "big-kick-right")) + + (action + (name "big-idle-right") + (fps 5.0) + (hitbox 16 5 32 64) + (images "big/idle-0.png" + "big/idle-1.png" + "big/idle-0.png")) + + (action + (name "big-idle-left") + (hitbox 16 5 32 64) + (mirror-action "big-idle-right")) + + (action + (name "big-duck-right") + (hitbox 16 37 32 32) + (images "big/duck-0.png")) + + (action + (name "big-duck-left") + (hitbox 16 37 32 32) + (mirror-action "big-duck-right")) + + (action + (name "big-backflip-right") + (hitbox 16 37 32 32) + (fps 9.0) + (images "big/backflip-0.png" + "big/backflip-1.png" + "big/backflip-2.png" + "big/backflip-3.png" + "big/backflip-4.png" + "big/backflip-0.png" + "big/backflip-0.png" + "big/backflip-0.png" + "big/backflip-0.png" + "big/backflip-0.png")) + + (action + (name "big-backflip-left") + (hitbox 16 37 32 32) + (fps 9.0) + (mirror-action "big-backflip-right")) + + +) diff --git a/src/object/player.cpp b/src/object/player.cpp index 978e07355..dc5abd91b 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -86,45 +86,9 @@ static const float CHEER_TIME = 1.0f; /** if Tux cannot unduck for this long, he will get hurt */ static const float UNDUCK_HURT_TIME = 0.25f; -// growing animation -Surface* growingtux_left[GROWING_FRAMES]; -Surface* growingtux_right[GROWING_FRAMES]; - -Surface* tux_life = 0; - -TuxBodyParts* small_tux = 0; -TuxBodyParts* big_tux = 0; -TuxBodyParts* fire_tux = 0; -TuxBodyParts* ice_tux = 0; - namespace{ bool no_water = true; } -void -TuxBodyParts::set_action(std::string action, int loops) -{ - if(head != NULL) - head->set_action(action, loops); - if(body != NULL) - body->set_action(action, loops); - if(arms != NULL) - arms->set_action(action, loops); - if(feet != NULL) - feet->set_action(action, loops); -} - -void -TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer, Portable* grabbed_object) -{ - if(head != NULL) - head->draw(context, pos, layer-2); - if(body != NULL) - body->draw(context, pos, layer-4); - if(arms != NULL) - arms->draw(context, pos, layer-1 + (grabbed_object?10:0)); - if(feet != NULL) - feet->draw(context, pos, layer-3); -} Player::Player(PlayerStatus* _player_status, const std::string& name) : scripting_controller(0), @@ -135,6 +99,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name) this->name = name; controller = main_controller; scripting_controller = new CodeController(); + sprite = sprite_manager->create("images/creatures/tux/tux.sprite"); smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite"); smalltux_star = sprite_manager->create("images/creatures/tux_small/smalltux-star.sprite"); bigtux_star = sprite_manager->create("images/creatures/tux_big/bigtux-star.sprite"); @@ -155,6 +120,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name) Player::~Player() { if (climbing) stop_climbing(*climbing); + delete sprite; delete smalltux_gameover; delete smalltux_star; delete bigtux_star; @@ -181,6 +147,7 @@ Player::init() jumping = false; can_jump = true; butt_jump = false; + growing = false; deactivated = false; backflipping = false; backflip_direction = 0; @@ -390,6 +357,10 @@ Player::update(float elapsed_time) } } + if (growing) { + if (sprite->animation_done()) growing = false; + } + } bool @@ -533,6 +504,7 @@ Player::do_duck() { if (adjust_height(31.8f)) { duck = true; + growing = false; unduck_hurt_timer.stop(); } else { // FIXME: what now? @@ -856,8 +828,10 @@ Player::set_bonus(BonusType type, bool animate) printf("can't adjust\n"); return false; } - if(animate) - growing_timer.start(GROWING_TIME); + if(animate) { + growing = true; + sprite->set_action((dir == LEFT)?"grow-left":"grow-right", 1); + } if (climbing) stop_climbing(*climbing); } @@ -926,133 +900,76 @@ Player::draw(DrawingContext& context) context.draw_surface(airarrow.get(), Vector(px, py), LAYER_HUD - 1); } - TuxBodyParts* tux_body; - + std::string sa_prefix = ""; if (player_status->bonus == GROWUP_BONUS) - tux_body = big_tux; + sa_prefix = "big"; else if (player_status->bonus == FIRE_BONUS) - tux_body = fire_tux; + sa_prefix = "big"; else if (player_status->bonus == ICE_BONUS) - tux_body = ice_tux; + sa_prefix = "big"; else - tux_body = small_tux; - - int layer = LAYER_OBJECTS + 1; + sa_prefix = "small"; /* Set Tux sprite action */ - if (climbing) - { - tux_body->set_action("skid-left"); - } - else if (backflipping) - { - if(dir == LEFT) - tux_body->set_action("backflip-left"); - else // dir == RIGHT - tux_body->set_action("backflip-right"); - } - else if (duck && is_big()) - { - if(dir == LEFT) - tux_body->set_action("duck-left"); - else // dir == RIGHT - tux_body->set_action("duck-right"); - } - else if (skidding_timer.started() && !skidding_timer.check()) - { - if(dir == LEFT) - tux_body->set_action("skid-left"); - else // dir == RIGHT - tux_body->set_action("skid-right"); - } - else if (kick_timer.started() && !kick_timer.check()) - { - if(dir == LEFT) - tux_body->set_action("kick-left"); - else // dir == RIGHT - tux_body->set_action("kick-right"); - } - else if (butt_jump && is_big()) - { - if(dir == LEFT) - tux_body->set_action("buttjump-left"); - else // dir == RIGHT - tux_body->set_action("buttjump-right"); - } - else if (!on_ground()) - { - if(dir == LEFT) - tux_body->set_action("jump-left"); - else // dir == RIGHT - tux_body->set_action("jump-right"); + if (growing) { + // while growing, do not change action + // do_duck() will take care of cancelling growing manually + // update() will take care of cancelling when growing completed + } + else if (climbing) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-skid-left":"-skid-right")); + } + else if (backflipping) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-backflip-left":"-backflip-right")); + } + else if (duck && is_big()) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-duck-left":"-duck-right")); + } + else if (skidding_timer.started() && !skidding_timer.check()) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-skid-left":"-skid-right")); + } + else if (kick_timer.started() && !kick_timer.check()) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-kick-left":"-kick-right")); + } + else if (butt_jump && is_big()) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-buttjump-left":"-buttjump-right")); + } + else if (!on_ground()) { + sprite->set_action(sa_prefix+((dir == LEFT)?"-jump-left":"-jump-right")); + } + else { + if (fabsf(physic.get_velocity_x()) < 1.0f) { +// if(idle_timer.check()) { +// sprite->set_action(sa_prefix+((dir == LEFT)?"-idle-left":"-idle-right")); +// } else { + sprite->set_action(sa_prefix+((dir == LEFT)?"-stand-left":"-stand-right")); +// } } - else - { - if (fabsf(physic.get_velocity_x()) < 1.0f) // standing - { - if(dir == LEFT) - tux_body->set_action("stand-left"); - else // dir == RIGHT - tux_body->set_action("stand-right"); - } - else // moving - { - if(dir == LEFT) - tux_body->set_action("walk-left"); - else // dir == RIGHT - tux_body->set_action("walk-right"); - } + else { + sprite->set_action(sa_prefix+((dir == LEFT)?"-walk-left":"-walk-right")); } + } - if(idle_timer.check()) - { - if(is_big()) - { - if(dir == LEFT) - tux_body->head->set_action("idle-left", 1); - else // dir == RIGHT - tux_body->head->set_action("idle-right", 1); - } - - } +/* // Tux is holding something if ((grabbed_object != 0 && physic.get_velocity_y() == 0) || - (shooting_timer.get_timeleft() > 0 && !shooting_timer.check())) - { - if (duck) - { - if(dir == LEFT) - tux_body->arms->set_action("duck+grab-left"); - else // dir == RIGHT - tux_body->arms->set_action("duck+grab-right"); - } - else - { - if(dir == LEFT) - tux_body->arms->set_action("grab-left"); - else // dir == RIGHT - tux_body->arms->set_action("grab-right"); - } + (shooting_timer.get_timeleft() > 0 && !shooting_timer.check())) { + if (duck) { + } else { } + } +*/ /* Draw Tux */ if(dying) { smalltux_gameover->draw(context, get_pos(), LAYER_FLOATINGOBJECTS + 1); } - else if ((growing_timer.get_timeleft() > 0) && (!duck)) { - if (dir == RIGHT) { - context.draw_surface(growingtux_right[int((growing_timer.get_timegone() * - GROWING_FRAMES) / GROWING_TIME)], get_pos(), layer); - } else { - context.draw_surface(growingtux_left[int((growing_timer.get_timegone() * - GROWING_FRAMES) / GROWING_TIME)], get_pos(), layer); - } - } else if (safe_timer.started() && size_t(game_time*40)%2) ; // don't draw Tux - else - tux_body->draw(context, get_pos(), layer, grabbed_object); + else { + sprite->draw(context, get_pos(), LAYER_OBJECTS + 1); + } } @@ -1167,19 +1084,17 @@ Player::kill(bool completely) physic.set_velocity_x(0); - if(!completely && (is_big() || growing_timer.started())) { + if(!completely && is_big()) { if(player_status->bonus == FIRE_BONUS || player_status->bonus == ICE_BONUS) { safe_timer.start(TUX_SAFE_TIME); set_bonus(GROWUP_BONUS, true); } else if(player_status->bonus == GROWUP_BONUS) { - //growing_timer.start(GROWING_TIME); safe_timer.start(TUX_SAFE_TIME /* + GROWING_TIME */); adjust_height(30.8f); duck = false; set_bonus(NO_BONUS, true); } else if(player_status->bonus == NO_BONUS) { - growing_timer.stop(); safe_timer.start(TUX_SAFE_TIME); adjust_height(30.8f); duck = false; diff --git a/src/object/player.hpp b/src/object/player.hpp index 4eea2ccfa..c65b6892e 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -52,37 +52,6 @@ static const int GROWING_FRAMES = 7; class Camera; class PlayerStatus; -extern Surface* growingtux_left[GROWING_FRAMES]; -extern Surface* growingtux_right[GROWING_FRAMES]; - -class TuxBodyParts -{ -public: - TuxBodyParts() - : head(0), body(0), arms(0), feet(0) - { } - ~TuxBodyParts() { - delete head; - delete body; - delete arms; - delete feet; - } - - void set_action(std::string action, int loops = -1); - void one_time_animation(); - void draw(DrawingContext& context, const Vector& pos, int layer, Portable* grabbed_object); - - Sprite* head; - Sprite* body; - Sprite* arms; - Sprite* feet; -}; - -extern TuxBodyParts* small_tux; -extern TuxBodyParts* big_tux; -extern TuxBodyParts* fire_tux; -extern TuxBodyParts* ice_tux; - class Player : public MovingObject, public UsesPhysic, public Scripting::Player, public ScriptInterface { public: @@ -124,7 +93,7 @@ public: Timer kick_timer; Timer shooting_timer; // used to show the arm when Tux is shooting Timer dying_timer; - Timer growing_timer; + bool growing; Timer idle_timer; Timer backflip_timer; @@ -307,6 +276,7 @@ private: Portable* grabbed_object; + Sprite* sprite; /**< The main sprite representing Tux */ Sprite* smalltux_gameover; Sprite* smalltux_star; Sprite* bigtux_star; diff --git a/src/resources.cpp b/src/resources.cpp index 07b098e74..04bc5725a 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -79,41 +79,6 @@ void load_shared() tile_manager = new TileManager(); sprite_manager = new SpriteManager(); - /* Tuxes: */ - char img_name[1024]; - for (int i = 0; i < GROWING_FRAMES; i++) - { - snprintf(img_name, sizeof(img_name), "images/creatures/tux_grow/left-%i.png", i+1); - growingtux_left[i] = new Surface(img_name); - - snprintf(img_name, sizeof(img_name), "images/creatures/tux_grow/right-%i.png", i+1); - growingtux_right[i] = new Surface(img_name); - } - - small_tux = new TuxBodyParts(); - small_tux->head = 0; - small_tux->body = sprite_manager->create("images/creatures/tux_small/small-tux-body.sprite"); - small_tux->arms = sprite_manager->create("images/creatures/tux_small/small-tux-arms.sprite"); - small_tux->feet = 0; - - big_tux = new TuxBodyParts(); - big_tux->head = sprite_manager->create("images/creatures/tux_big/big-tux-head.sprite"); - big_tux->body = sprite_manager->create("images/creatures/tux_big/big-tux-body.sprite"); - big_tux->arms = sprite_manager->create("images/creatures/tux_big/big-tux-arms.sprite"); - big_tux->feet = sprite_manager->create("images/creatures/tux_big/big-tux-feet.sprite"); - - fire_tux = new TuxBodyParts(); - fire_tux->head = sprite_manager->create("images/creatures/tux_big/big-fire-tux-head.sprite"); - fire_tux->body = sprite_manager->create("images/creatures/tux_big/big-tux-body.sprite"); - fire_tux->arms = sprite_manager->create("images/creatures/tux_big/big-tux-arms.sprite"); - fire_tux->feet = sprite_manager->create("images/creatures/tux_big/big-tux-feet.sprite"); - - ice_tux = new TuxBodyParts(); - ice_tux->head = sprite_manager->create("images/creatures/tux_big/big-ice-tux-head.sprite"); - ice_tux->body = sprite_manager->create("images/creatures/tux_big/big-tux-body.sprite"); - ice_tux->arms = sprite_manager->create("images/creatures/tux_big/big-tux-arms.sprite"); - ice_tux->feet = sprite_manager->create("images/creatures/tux_big/big-tux-feet.sprite"); - player_status = new PlayerStatus(); } @@ -129,16 +94,6 @@ void unload_shared() delete white_small_text; delete white_big_text; - delete small_tux; - delete big_tux; - delete fire_tux; - delete ice_tux; - - for (int i = 0; i < GROWING_FRAMES; i++) { - delete growingtux_left[i]; - delete growingtux_right[i]; - } - delete sprite_manager; sprite_manager = NULL;