2 // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
3 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "sprite/sprite.hpp"
20 #include "sprite/sprite_manager.hpp"
21 #include "video/drawing_context.hpp"
22 #include "worldmap/special_tile.hpp"
24 namespace WorldMapNS {
26 SpecialTile::SpecialTile(const lisp::Lisp* lisp)
27 : passive_message(false), invisible(false),
28 apply_action_north(true), apply_action_east(true),
29 apply_action_south(true), apply_action_west(true)
31 lisp->get("x", pos.x);
32 lisp->get("y", pos.y);
33 lisp->get("invisible-tile", invisible);
36 std::string spritefile = "";
37 lisp->get("sprite", spritefile);
38 sprite = sprite_manager->create(spritefile);
41 lisp->get("map-message", map_message);
42 lisp->get("passive-message", passive_message);
43 lisp->get("script", script);
45 std::string apply_direction;
46 lisp->get("apply-to-direction", apply_direction);
47 if(!apply_direction.empty()) {
48 apply_action_north = false;
49 apply_action_south = false;
50 apply_action_east = false;
51 apply_action_west = false;
52 if(apply_direction.find("north") != std::string::npos)
53 apply_action_north = true;
54 if(apply_direction.find("south") != std::string::npos)
55 apply_action_south = true;
56 if(apply_direction.find("east") != std::string::npos)
57 apply_action_east = true;
58 if(apply_direction.find("west") != std::string::npos)
59 apply_action_west = true;
63 SpecialTile::~SpecialTile()
68 SpecialTile::draw(DrawingContext& context)
73 sprite->draw(context, pos*32 + Vector(16, 16), LAYER_OBJECTS - 1);
77 SpecialTile::update(float )