1 | // SuperTux |
---|---|
2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
3 | // |
4 | // This program is free software: you can redistribute it and/or modify |
5 | // it under the terms of the GNU General Public License as published by |
6 | // the Free Software Foundation, either version 3 of the License, or |
7 | // (at your option) any later version. |
8 | // |
9 | // This program is distributed in the hope that it will be useful, |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | // GNU General Public License for more details. |
13 | // |
14 | // You should have received a copy of the GNU General Public License |
15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | |
17 | #include "scripting/level.hpp" |
18 | |
19 | #include "supertux/flip_level_transformer.hpp" |
20 | #include "supertux/game_session.hpp" |
21 | |
22 | namespace scripting { |
23 | |
24 | void |
25 | Level_finish(bool win) |
26 | { |
27 | if (GameSession::current() == nullptr) |
28 | return; |
29 | |
30 | GameSession::current()->finish(win); |
31 | } |
32 | |
33 | void |
34 | Level_spawn(const std::string& sector, const std::string& spawnpoint) |
35 | { |
36 | if (GameSession::current() == nullptr) |
37 | return; |
38 | |
39 | GameSession::current()->respawn(sector, spawnpoint); |
40 | } |
41 | |
42 | void |
43 | Level_flip_vertically() |
44 | { |
45 | FlipLevelTransformer flip_transformer; |
46 | flip_transformer.transform(GameSession::current()->get_current_level()); |
47 | } |
48 | |
49 | void |
50 | Level_toggle_pause() |
51 | { |
52 | if (GameSession::current() == nullptr) |
53 | return; |
54 | GameSession::current()->toggle_pause(); |
55 | } |
56 | |
57 | void |
58 | Level_edit(bool edit_mode) |
59 | { |
60 | if (GameSession::current() == nullptr) return; |
61 | GameSession::current()->set_editmode(edit_mode); |
62 | } |
63 | |
64 | } // namespace scripting |
65 | |
66 | /* EOF */ |
67 |