4 // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
5 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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 02111-1307, USA.
22 #include "worldmap/special_tile.hpp"
23 #include "sprite/sprite_manager.hpp"
24 #include "sprite/sprite.hpp"
25 #include "video/drawing_context.hpp"
30 SpecialTile::SpecialTile(const lisp::Lisp* lisp)
31 : passive_message(false), invisible(false),
32 apply_action_north(true), apply_action_east(true),
33 apply_action_south(true), apply_action_west(true)
35 lisp->get("x", pos.x);
36 lisp->get("y", pos.y);
37 lisp->get("invisible-tile", invisible);
40 std::string spritefile = "";
41 lisp->get("sprite", spritefile);
42 sprite.reset(sprite_manager->create(spritefile));
45 lisp->get("map-message", map_message);
46 lisp->get("passive-message", passive_message);
47 lisp->get("script", script);
49 std::string apply_direction;
50 lisp->get("apply-to-direction", apply_direction);
51 if(!apply_direction.empty()) {
52 apply_action_north = false;
53 apply_action_south = false;
54 apply_action_east = false;
55 apply_action_west = false;
56 if(apply_direction.find("north") != std::string::npos)
57 apply_action_north = true;
58 if(apply_direction.find("south") != std::string::npos)
59 apply_action_south = true;
60 if(apply_direction.find("east") != std::string::npos)
61 apply_action_east = true;
62 if(apply_direction.find("west") != std::string::npos)
63 apply_action_west = true;
67 SpecialTile::~SpecialTile()
72 SpecialTile::draw(DrawingContext& context)
77 sprite->draw(context, pos*32 + Vector(16, 16), LAYER_OBJECTS - 1);
81 SpecialTile::update(float )