From: wolfgangb Date: Sun, 30 Aug 2009 15:41:51 +0000 (+0000) Subject: Patchs by Matt McCutche to fix Treeboss related Bugs 469 and 504. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=68aff5b0cf37e4845e3f3d1f496c698cf827c6ca;p=supertux.git Patchs by Matt McCutche to fix Treeboss related Bugs 469 and 504. * Tree willowisps should start at tree boss, not (0, 0) * Crash if tree boss creates root while player is dying git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@5911 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/badguy/ghosttree.cpp b/src/badguy/ghosttree.cpp index e349f6d92..c00538ea9 100644 --- a/src/badguy/ghosttree.cpp +++ b/src/badguy/ghosttree.cpp @@ -158,8 +158,10 @@ GhostTree::active_update(float elapsed_time) if(root_timer.check()) { /* TODO indicate root with an animation */ Player* player = get_nearest_player(); - Root* root = new Root(Vector(player->get_bbox().get_left(), get_bbox().get_bottom()+ROOT_TOP_OFFSET)); - Sector::current()->add_object(root); + if (player) { + Root* root = new Root(Vector(player->get_bbox().get_left(), get_bbox().get_bottom()+ROOT_TOP_OFFSET)); + Sector::current()->add_object(root); + } } } else if (mystate == STATE_SWALLOWING) { if (suck_lantern) { diff --git a/src/badguy/treewillowisp.cpp b/src/badguy/treewillowisp.cpp index a1a63438c..f25ea5323 100644 --- a/src/badguy/treewillowisp.cpp +++ b/src/badguy/treewillowisp.cpp @@ -37,16 +37,14 @@ static const float SUCKSPEED = 25; TreeWillOWisp::TreeWillOWisp(GhostTree* tree, const Vector& pos, float radius, float speed) - : BadGuy(Vector(0, 0), "images/creatures/willowisp/willowisp.sprite", + : BadGuy(tree->get_pos() + pos, "images/creatures/willowisp/willowisp.sprite", LAYER_OBJECTS - 20), was_sucked(false), mystate(STATE_DEFAULT), tree(tree) { - treepos_delta = pos; sound_manager->preload(SOUNDFILE); this->radius = radius; this->angle = 0; this->speed = speed; - start_position = tree->get_pos() + treepos_delta; set_colgroup_active(COLGROUP_MOVING); } @@ -137,7 +135,7 @@ TreeWillOWisp::active_update(float elapsed_time) } angle = fmodf(angle + elapsed_time * speed, (float) (2*M_PI)); - Vector newpos(tree->get_pos() + treepos_delta + Vector(sin(angle) * radius, 0)); + Vector newpos(start_position + Vector(sin(angle) * radius, 0)); movement = newpos - get_pos(); float sizemod = cos(angle) * 0.8f; /* TODO: modify sprite size */ diff --git a/src/badguy/treewillowisp.hpp b/src/badguy/treewillowisp.hpp index b452e3f56..facd07a50 100644 --- a/src/badguy/treewillowisp.hpp +++ b/src/badguy/treewillowisp.hpp @@ -67,7 +67,6 @@ private: float speed; std::auto_ptr sound_source; - Vector treepos_delta; GhostTree* tree; Vector suck_target;