2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
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.
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.
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/>.
17 #ifndef HEADER_SUPERTUX_SCRIPTING_FUNCTIONS_HPP
18 #define HEADER_SUPERTUX_SCRIPTING_FUNCTIONS_HPP
31 * Display the value of the argument. This is useful for inspecting tables.
33 SQInteger display(HSQUIRRELVM vm) __custom("t.");
36 * Displays contents of the current stack
38 void print_stacktrace(HSQUIRRELVM vm);
41 * returns the currently running thread
43 SQInteger get_current_thread(HSQUIRRELVM vm) __custom("t");
46 * Display a text file and scrolls it over the screen (on next screenswitch)
48 void display_text_file(const std::string& filename);
51 * Load and display a worldmap (on next screenswitch)
53 void load_worldmap(const std::string& filename);
56 * Load and display a level (on next screenswitch)
58 void load_level(const std::string& filename);
61 * Suspend the script execution for the specified number of seconds
63 void wait(HSQUIRRELVM vm, float seconds) __suspend;
66 * Suspend the script execution until the current screen has been changed
68 void wait_for_screenswitch(HSQUIRRELVM vm) __suspend;
71 * Exits the currently running screen (force exit from worldmap or scrolling
77 * Does a fadeout for the specified number of seconds before next screenchange
79 void fadeout_screen(float seconds);
82 * Does a shrinking fade towards the destposition for the specified number of
83 * seconds before next screenchange
85 void shrink_screen(float dest_x, float dest_y, float seconds);
88 * Aborts any kind of previous screen fade; the screenchange will happen
91 void abort_screenfade();
94 * Translate a text into the users language (by looking it up in the .po
97 std::string translate(const std::string& text);
100 * Load a script file and executes it. This is typically used to import
101 * functions from external files.
103 void import(HSQUIRRELVM v, const std::string& filename);
106 * Save world state to savegame
111 * Update worldmap from worldmap state (state.world variable)
113 void update_worldmap();
116 * enable/disable drawing of collision rectangles
118 void debug_collrects(bool enable);
121 * enable/disable drawing of fps
123 void debug_show_fps(bool enable);
126 * enable/disable drawing of non-solid layers
128 void debug_draw_solids_only(bool enable);
131 * enable/disable worldmap ghost mode
133 void debug_worldmap_ghost(bool enable);
136 * Changes music to musicfile
138 void play_music(const std::string& musicfile);
143 void play_sound(const std::string& soundfile);
148 void set_game_speed(float speed);
156 * makes Tux invincible for 10000 units of time
161 * makes Tux a ghost, i.e. lets him float around and through solid objects
166 * recall Tux's invincibility and ghost status
171 * reinitialise and respawn Tux at the beginning of the current level
176 * print Tux's current coordinates in a level
181 * move Tux near the end of the level
186 * show the camera's coordinates
193 void set_gamma(float gamma);
201 * Returns a random integer
206 * Record a demo to the given file.
208 void record_demo(const std::string& filename);
211 * Play back a demo from the given file.
213 void play_demo(const std::string& filename);
215 } // namespace Scripting