3 // SuperTux - A Jump'n Run
4 // Copyright (C) 2004 Matthias Braun <matze@braunis.de
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "lispreader.h"
22 #include "lispwriter.h"
24 #include "resources.h"
26 #include "sprite_manager.h"
27 #include "screen/drawing_context.h"
29 Door::Door(LispReader& reader)
31 reader.read_float("x", area.x);
32 reader.read_float("y", area.y);
36 reader.read_string("sector", target_sector);
37 reader.read_string("spawnpoint", target_spawnpoint);
39 sprite = sprite_manager->load("door");
43 Door::write(LispWriter& writer)
45 writer.start_list("door");
47 writer.write_float("x", area.x);
48 writer.write_float("y", area.y);
49 writer.write_float("width", area.width);
50 writer.write_float("height", area.height);
52 writer.write_string("sector", target_sector);
53 writer.write_string("spawnpoint", target_spawnpoint);
55 writer.end_list("door");
68 Door::draw(DrawingContext& context)
70 sprite->draw(context, Vector(area.x, area.y), LAYER_TILES);
74 Door::interaction(InteractionType type)
76 if(type == INTERACTION_ACTIVATE) {
77 GameSession::current()->respawn(target_sector, target_spawnpoint);