#303: Typo fixes from mathnerd314
[supertux.git] / src / scripting / functions.hpp
1 //  $Id$
2 //
3 //  SuperTux
4 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
5 //
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.
10 //
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.
15 //
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.
19
20 #ifndef __FUNCTIONS_H__
21 #define __FUNCTIONS_H__
22
23 #ifndef SCRIPTING_API
24 #define __suspend
25 #define __custom
26 #include <string>
27 #include "player_status.hpp"
28 #endif
29
30 namespace Scripting
31 {
32
33 /**
34  * Display the value of the argument. This is useful for inspecting tables.
35  */
36 SQInteger display(HSQUIRRELVM vm) __custom;
37
38 /**
39  * Displays contents of the current stack
40  */
41 void print_stacktrace(HSQUIRRELVM vm);
42
43 /**
44  * returns the currently running thread
45  */
46 SQInteger get_current_thread(HSQUIRRELVM vm) __custom;
47
48 /**
49  * Display a text file and scrolls it over the screen (on next screenswitch)
50  */
51 void display_text_file(const std::string& filename);
52
53 /**
54  * Load and display a worldmap (on next screenswitch)
55  */
56 void load_worldmap(const std::string& filename);
57
58 /**
59  * Load and display a level (on next screenswitch)
60  */
61 void load_level(const std::string& filename);
62
63 /**
64  * Suspend the script execution for the specified number of seconds
65  */
66 void wait(HSQUIRRELVM vm, float seconds) __suspend;
67
68 /**
69  * Suspend the script execution until the current screen has been changed
70  */
71 void wait_for_screenswitch(HSQUIRRELVM vm) __suspend;
72
73 /**
74  * Exits the currently running screen (force exit from worldmap or scrolling
75  * text for example)
76  */
77 void exit_screen();
78
79 /**
80  * Does a fadeout for the specified number of seconds before next screenchange
81  */
82 void fadeout_screen(float seconds);
83
84 /**
85  * Does a shrinking fade towards the destposition for the specified number of
86  * seconds before next screenchange
87  */
88 void shrink_screen(float dest_x, float dest_y, float seconds);
89
90 /**
91  * Aborts any kind of previous screen fade; the screenchange will happen
92  * anyway.
93  */
94 void abort_screenfade();
95
96 /**
97  * Translate a text into the users language (by looking it up in the .po
98  * files)
99  */
100 std::string translate(const std::string& text);
101
102 /**
103  * Load a script file and executes it. This is typically used to import
104  * functions from external files.
105  */
106 void import(HSQUIRRELVM v, const std::string& filename);
107
108 /**
109  * Save world state to savegame
110  */
111 void save_state();
112
113 /**
114  * Update worldmap from worldmap state (state.world variable)
115  */
116 void update_worldmap();
117
118 /**
119  * enable/disable drawing of collision rectangles
120  */
121 void debug_collrects(bool enable);
122
123 /**
124  * enable/disable drawing of fps
125  */
126 void debug_show_fps(bool enable);
127
128 /**
129  * enable/disable drawing of non-solid layers
130  */
131 void debug_draw_solids_only(bool enable);
132
133 /**
134  * Changes music to musicfile
135  */
136 void play_music(const std::string& musicfile);
137
138 /**
139  * Plays a soundfile
140  */
141 void play_sound(const std::string& soundfile);
142
143 /**
144  *  Set the game_speed
145  */
146 void set_game_speed(float speed);
147
148 /**
149  * speeds Tux up
150  */
151 void grease();
152
153 /**
154  * makes Tux invincible for 10000 units of time
155  */
156 void invincible();
157
158 /**
159  * makes Tux a ghost, i.e. lets him float around and through solid objects
160  */
161 void ghost();
162
163 /**
164  * recall Tux's invincibility and ghost status
165  */
166 void mortal();
167
168 /**
169  * reinitialise and respawn Tux at the beginning of the current level
170  */
171 void restart();
172
173 /**
174  * print Tux's current coordinates in a level
175  */
176 void whereami();
177
178 /**
179  * move Tux near the end of the level
180  */
181 void gotoend();
182
183 /**
184  * show the camera's coordinates
185  */
186 void camera();
187
188 /**
189  * exit the game
190  */
191 void quit();
192
193 /**
194  * Returns a random integer
195  */
196 int rand();
197
198 }
199
200 #endif