4 // Copyright (C) 2006 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.
20 #ifndef __FUNCTIONS_H__
21 #define __FUNCTIONS_H__
27 #include "player_status.hpp"
34 * Display the value of the argument. This is usefull for inspecting tables.
36 SQInteger display(HSQUIRRELVM vm) __custom;
39 * Displays contents of the current stack
41 void print_stacktrace(HSQUIRRELVM vm);
44 * returns the currently running thread
46 SQInteger get_current_thread(HSQUIRRELVM vm) __custom;
49 * Display a text file and scrolls it over the screen (on next screenswitch)
51 void display_text_file(const std::string& filename);
54 * Load and display a worldmap (on next screenswitch)
56 void load_worldmap(const std::string& filename);
59 * Load and display a level (on next screenswitch)
61 void load_level(const std::string& filename);
64 * Suspend the script execution for the specified number of seconds
66 void wait(HSQUIRRELVM vm, float seconds) __suspend;
69 * Suspend the script execution until the current screen has been changed
71 void wait_for_screenswitch(HSQUIRRELVM vm) __suspend;
74 * Exits the currently running screen (force exit from worldmap or scrolling
80 * Does a fadeout for the specified number of seconds before next screenchange
82 void fadeout_screen(float seconds);
85 * Does a shrinking fade towards the destposition for the specified number of
86 * seconds before next screenchange
88 void shrink_screen(float dest_x, float dest_y, float seconds);
91 * Translate a text into the users language (by looking it up in the .po
94 std::string translate(const std::string& text);
97 * Load a script file and executes it. This is typically used to import
98 * functions from external files.
100 void import(HSQUIRRELVM v, const std::string& filename);
103 * Save world state to savegame
108 * enable/disable drawing of collision rectangles
110 void debug_collrects(bool enable);
113 * enable/disable drawing of fps
115 void debug_draw_fps(bool enable);
118 * enable/disable drawing of non-solid layers
120 void debug_draw_solids_only(bool enable);
123 * Changes music to musicfile
125 void play_music(const std::string& musicfile);
130 void play_sound(const std::string& soundfile);
138 * makes Tux invincible for 10000 units of time
143 * makes Tux a ghost, i.e. lets him float around and through solid objects
148 * recall Tux's invincibility and ghost status
153 * reinitialise and respawn Tux at the beginning of the current level
158 * print Tux's current coordinates in a level
163 * move Tux near the end of the level
168 * show the camera's coordinates
178 * Returns a random integer