From: Ricardo Cruz Date: Mon, 18 Oct 2004 21:09:28 +0000 (+0000) Subject: Implemented mirror actions correctly. Bugfix: right direction of bad guys now working. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e4db6eb50cd6bcba607858b5e6c4c5d53531ed1f;p=supertux.git Implemented mirror actions correctly. Bugfix: right direction of bad guys now working. Also fixed bomb exploding animation and also badguys being draw in top left of level. SVN-Revision: 2028 --- diff --git a/lib/special/sprite.cpp b/lib/special/sprite.cpp index d713d5fd2..82639166e 100644 --- a/lib/special/sprite.cpp +++ b/lib/special/sprite.cpp @@ -271,7 +271,7 @@ Sprite::draw(DrawingContext& context, const Vector& pos, int layer, else context.draw_surface(action->surfaces[(int)frame], pos - Vector(action->x_offset, action->y_offset), layer + action->z_order, - drawing_effect); + action->mirror ? drawing_effect | HORIZONTAL_FLIP : drawing_effect); } void @@ -287,7 +287,7 @@ Sprite::draw_part(DrawingContext& context, const Vector& source, const Vector& s else context.draw_surface_part(action->surfaces[(int)frame], source, size, pos - Vector(action->x_offset, action->y_offset), layer + action->z_order, - drawing_effect); + action->mirror ? drawing_effect | HORIZONTAL_FLIP : drawing_effect); } int diff --git a/src/badguy.cpp b/src/badguy.cpp index 71a35ad10..eca1d24d5 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -68,6 +68,8 @@ BadGuyKind badguykind_from_string(const std::string& str) return BAD_WINGLING; else if (str == "walkingtree") return BAD_WALKINGTREE; + else if(str == "bomb") // not to be used as a real bad guys + return BAD_BOMB; else { return BAD_INVALID; @@ -116,6 +118,9 @@ std::string badguykind_to_string(BadGuyKind kind) break; case BAD_WALKINGTREE: return "walkingtree"; + case BAD_BOMB: // not to be used as a real bad guys + return "bomb"; + break; default: return "snowball"; } @@ -172,6 +177,8 @@ BadGuy::init() specs = badguyspecs_manager->load(badguykind_to_string(kind)); + set_action("hide", "hide"); + // if we're in a solid tile at start correct that now if(Sector::current()) { if(kind != BAD_FLAME && kind != BAD_FISH && kind != BAD_FLAMEFISH && collision_object_map(base)) @@ -965,6 +972,8 @@ BadGuy::set_action(std::string left, std::string right) action_left = left; action_right = right; +std::cerr << "set_action(" << left << ", " << right << ") of " << badguykind_to_string(kind) << std::endl; + #if 0 if (1) { diff --git a/src/player.cpp b/src/player.cpp index 0b50d3b61..f84fd03ff 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -992,7 +992,7 @@ Player::draw(DrawingContext& context) else if (safe_timer.started() && global_frame_counter%2) ; // don't draw Tux else - tux_body->draw(context, pos, layer, dir == LEFT ? HORIZONTAL_FLIP : NONE_EFFECT); + tux_body->draw(context, pos, layer); // Draw blinking star overlay if (invincible_timer.started() &&