e0ab1c23a0286d0a86fd70b20ecca569eaa7bf3a
[supertux.git] / src / scripting / wrapper.cpp
1 /**
2  * WARNING: This file is automatically generated from:
3  *  'src/scripting/wrapper.interface.hpp'
4  * DO NOT CHANGE
5  */
6 #include <config.h>
7
8 #include <new>
9 #include <assert.h>
10 #include <string>
11 #include <sstream>
12 #include <squirrel.h>
13 #include "squirrel_error.hpp"
14 #include "wrapper.interface.hpp"
15
16 namespace Scripting
17 {
18 namespace Wrapper
19 {
20
21 static SQInteger DisplayEffect_release_hook(SQUserPointer ptr, SQInteger )
22 {
23   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (ptr);
24   delete _this;
25   return 0;
26 }
27
28 static SQInteger DisplayEffect_fade_out_wrapper(HSQUIRRELVM vm)
29 {
30   SQUserPointer data;
31   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
32     sq_throwerror(vm, _SC("'fade_out' called without instance"));
33     return SQ_ERROR;
34   }
35   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (data);
36   SQFloat arg0;
37   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
38     sq_throwerror(vm, _SC("Argument 1 not a float"));
39     return SQ_ERROR;
40   }
41
42   try {
43     _this->fade_out(static_cast<float> (arg0));
44
45     return 0;
46
47   } catch(std::exception& e) {
48     sq_throwerror(vm, e.what());
49     return SQ_ERROR;
50   } catch(...) {
51     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
52     return SQ_ERROR;
53   }
54
55 }
56
57 static SQInteger DisplayEffect_fade_in_wrapper(HSQUIRRELVM vm)
58 {
59   SQUserPointer data;
60   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
61     sq_throwerror(vm, _SC("'fade_in' called without instance"));
62     return SQ_ERROR;
63   }
64   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (data);
65   SQFloat arg0;
66   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
67     sq_throwerror(vm, _SC("Argument 1 not a float"));
68     return SQ_ERROR;
69   }
70
71   try {
72     _this->fade_in(static_cast<float> (arg0));
73
74     return 0;
75
76   } catch(std::exception& e) {
77     sq_throwerror(vm, e.what());
78     return SQ_ERROR;
79   } catch(...) {
80     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
81     return SQ_ERROR;
82   }
83
84 }
85
86 static SQInteger DisplayEffect_set_black_wrapper(HSQUIRRELVM vm)
87 {
88   SQUserPointer data;
89   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
90     sq_throwerror(vm, _SC("'set_black' called without instance"));
91     return SQ_ERROR;
92   }
93   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (data);
94   SQBool arg0;
95   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
96     sq_throwerror(vm, _SC("Argument 1 not a bool"));
97     return SQ_ERROR;
98   }
99
100   try {
101     _this->set_black(arg0 == SQTrue);
102
103     return 0;
104
105   } catch(std::exception& e) {
106     sq_throwerror(vm, e.what());
107     return SQ_ERROR;
108   } catch(...) {
109     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_black'"));
110     return SQ_ERROR;
111   }
112
113 }
114
115 static SQInteger DisplayEffect_is_black_wrapper(HSQUIRRELVM vm)
116 {
117   SQUserPointer data;
118   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
119     sq_throwerror(vm, _SC("'is_black' called without instance"));
120     return SQ_ERROR;
121   }
122   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (data);
123
124   try {
125     bool return_value = _this->is_black();
126
127     sq_pushbool(vm, return_value);
128     return 1;
129
130   } catch(std::exception& e) {
131     sq_throwerror(vm, e.what());
132     return SQ_ERROR;
133   } catch(...) {
134     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_black'"));
135     return SQ_ERROR;
136   }
137
138 }
139
140 static SQInteger DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM vm)
141 {
142   SQUserPointer data;
143   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
144     sq_throwerror(vm, _SC("'sixteen_to_nine' called without instance"));
145     return SQ_ERROR;
146   }
147   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (data);
148   SQFloat arg0;
149   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
150     sq_throwerror(vm, _SC("Argument 1 not a float"));
151     return SQ_ERROR;
152   }
153
154   try {
155     _this->sixteen_to_nine(static_cast<float> (arg0));
156
157     return 0;
158
159   } catch(std::exception& e) {
160     sq_throwerror(vm, e.what());
161     return SQ_ERROR;
162   } catch(...) {
163     sq_throwerror(vm, _SC("Unexpected exception while executing function 'sixteen_to_nine'"));
164     return SQ_ERROR;
165   }
166
167 }
168
169 static SQInteger DisplayEffect_four_to_three_wrapper(HSQUIRRELVM vm)
170 {
171   SQUserPointer data;
172   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
173     sq_throwerror(vm, _SC("'four_to_three' called without instance"));
174     return SQ_ERROR;
175   }
176   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (data);
177   SQFloat arg0;
178   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
179     sq_throwerror(vm, _SC("Argument 1 not a float"));
180     return SQ_ERROR;
181   }
182
183   try {
184     _this->four_to_three(static_cast<float> (arg0));
185
186     return 0;
187
188   } catch(std::exception& e) {
189     sq_throwerror(vm, e.what());
190     return SQ_ERROR;
191   } catch(...) {
192     sq_throwerror(vm, _SC("Unexpected exception while executing function 'four_to_three'"));
193     return SQ_ERROR;
194   }
195
196 }
197
198 static SQInteger Camera_release_hook(SQUserPointer ptr, SQInteger )
199 {
200   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
201   delete _this;
202   return 0;
203 }
204
205 static SQInteger Camera_shake_wrapper(HSQUIRRELVM vm)
206 {
207   SQUserPointer data;
208   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
209     sq_throwerror(vm, _SC("'shake' called without instance"));
210     return SQ_ERROR;
211   }
212   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (data);
213   SQFloat arg0;
214   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
215     sq_throwerror(vm, _SC("Argument 1 not a float"));
216     return SQ_ERROR;
217   }
218   SQFloat arg1;
219   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
220     sq_throwerror(vm, _SC("Argument 2 not a float"));
221     return SQ_ERROR;
222   }
223   SQFloat arg2;
224   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
225     sq_throwerror(vm, _SC("Argument 3 not a float"));
226     return SQ_ERROR;
227   }
228
229   try {
230     _this->shake(static_cast<float> (arg0), static_cast<float> (arg1), static_cast<float> (arg2));
231
232     return 0;
233
234   } catch(std::exception& e) {
235     sq_throwerror(vm, e.what());
236     return SQ_ERROR;
237   } catch(...) {
238     sq_throwerror(vm, _SC("Unexpected exception while executing function 'shake'"));
239     return SQ_ERROR;
240   }
241
242 }
243
244 static SQInteger Camera_set_pos_wrapper(HSQUIRRELVM vm)
245 {
246   SQUserPointer data;
247   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
248     sq_throwerror(vm, _SC("'set_pos' called without instance"));
249     return SQ_ERROR;
250   }
251   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (data);
252   SQFloat arg0;
253   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
254     sq_throwerror(vm, _SC("Argument 1 not a float"));
255     return SQ_ERROR;
256   }
257   SQFloat arg1;
258   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
259     sq_throwerror(vm, _SC("Argument 2 not a float"));
260     return SQ_ERROR;
261   }
262
263   try {
264     _this->set_pos(static_cast<float> (arg0), static_cast<float> (arg1));
265
266     return 0;
267
268   } catch(std::exception& e) {
269     sq_throwerror(vm, e.what());
270     return SQ_ERROR;
271   } catch(...) {
272     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
273     return SQ_ERROR;
274   }
275
276 }
277
278 static SQInteger Camera_set_mode_wrapper(HSQUIRRELVM vm)
279 {
280   SQUserPointer data;
281   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
282     sq_throwerror(vm, _SC("'set_mode' called without instance"));
283     return SQ_ERROR;
284   }
285   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (data);
286   const SQChar* arg0;
287   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
288     sq_throwerror(vm, _SC("Argument 1 not a string"));
289     return SQ_ERROR;
290   }
291
292   try {
293     _this->set_mode(arg0);
294
295     return 0;
296
297   } catch(std::exception& e) {
298     sq_throwerror(vm, e.what());
299     return SQ_ERROR;
300   } catch(...) {
301     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_mode'"));
302     return SQ_ERROR;
303   }
304
305 }
306
307 static SQInteger Camera_scroll_to_wrapper(HSQUIRRELVM vm)
308 {
309   SQUserPointer data;
310   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
311     sq_throwerror(vm, _SC("'scroll_to' called without instance"));
312     return SQ_ERROR;
313   }
314   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (data);
315   SQFloat arg0;
316   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
317     sq_throwerror(vm, _SC("Argument 1 not a float"));
318     return SQ_ERROR;
319   }
320   SQFloat arg1;
321   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
322     sq_throwerror(vm, _SC("Argument 2 not a float"));
323     return SQ_ERROR;
324   }
325   SQFloat arg2;
326   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
327     sq_throwerror(vm, _SC("Argument 3 not a float"));
328     return SQ_ERROR;
329   }
330
331   try {
332     _this->scroll_to(static_cast<float> (arg0), static_cast<float> (arg1), static_cast<float> (arg2));
333
334     return 0;
335
336   } catch(std::exception& e) {
337     sq_throwerror(vm, e.what());
338     return SQ_ERROR;
339   } catch(...) {
340     sq_throwerror(vm, _SC("Unexpected exception while executing function 'scroll_to'"));
341     return SQ_ERROR;
342   }
343
344 }
345
346 static SQInteger Level_release_hook(SQUserPointer ptr, SQInteger )
347 {
348   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
349   delete _this;
350   return 0;
351 }
352
353 static SQInteger Level_finish_wrapper(HSQUIRRELVM vm)
354 {
355   SQUserPointer data;
356   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
357     sq_throwerror(vm, _SC("'finish' called without instance"));
358     return SQ_ERROR;
359   }
360   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (data);
361   SQBool arg0;
362   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
363     sq_throwerror(vm, _SC("Argument 1 not a bool"));
364     return SQ_ERROR;
365   }
366
367   try {
368     _this->finish(arg0 == SQTrue);
369
370     return 0;
371
372   } catch(std::exception& e) {
373     sq_throwerror(vm, e.what());
374     return SQ_ERROR;
375   } catch(...) {
376     sq_throwerror(vm, _SC("Unexpected exception while executing function 'finish'"));
377     return SQ_ERROR;
378   }
379
380 }
381
382 static SQInteger Level_spawn_wrapper(HSQUIRRELVM vm)
383 {
384   SQUserPointer data;
385   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
386     sq_throwerror(vm, _SC("'spawn' called without instance"));
387     return SQ_ERROR;
388   }
389   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (data);
390   const SQChar* arg0;
391   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
392     sq_throwerror(vm, _SC("Argument 1 not a string"));
393     return SQ_ERROR;
394   }
395   const SQChar* arg1;
396   if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) {
397     sq_throwerror(vm, _SC("Argument 2 not a string"));
398     return SQ_ERROR;
399   }
400
401   try {
402     _this->spawn(arg0, arg1);
403
404     return 0;
405
406   } catch(std::exception& e) {
407     sq_throwerror(vm, e.what());
408     return SQ_ERROR;
409   } catch(...) {
410     sq_throwerror(vm, _SC("Unexpected exception while executing function 'spawn'"));
411     return SQ_ERROR;
412   }
413
414 }
415
416 static SQInteger Level_flip_vertically_wrapper(HSQUIRRELVM vm)
417 {
418   SQUserPointer data;
419   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
420     sq_throwerror(vm, _SC("'flip_vertically' called without instance"));
421     return SQ_ERROR;
422   }
423   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (data);
424
425   try {
426     _this->flip_vertically();
427
428     return 0;
429
430   } catch(std::exception& e) {
431     sq_throwerror(vm, e.what());
432     return SQ_ERROR;
433   } catch(...) {
434     sq_throwerror(vm, _SC("Unexpected exception while executing function 'flip_vertically'"));
435     return SQ_ERROR;
436   }
437
438 }
439
440 static SQInteger Level_toggle_pause_wrapper(HSQUIRRELVM vm)
441 {
442   SQUserPointer data;
443   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
444     sq_throwerror(vm, _SC("'toggle_pause' called without instance"));
445     return SQ_ERROR;
446   }
447   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (data);
448
449   try {
450     _this->toggle_pause();
451
452     return 0;
453
454   } catch(std::exception& e) {
455     sq_throwerror(vm, e.what());
456     return SQ_ERROR;
457   } catch(...) {
458     sq_throwerror(vm, _SC("Unexpected exception while executing function 'toggle_pause'"));
459     return SQ_ERROR;
460   }
461
462 }
463
464 static SQInteger ScriptedObject_release_hook(SQUserPointer ptr, SQInteger )
465 {
466   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
467   delete _this;
468   return 0;
469 }
470
471 static SQInteger ScriptedObject_set_action_wrapper(HSQUIRRELVM vm)
472 {
473   SQUserPointer data;
474   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
475     sq_throwerror(vm, _SC("'set_action' called without instance"));
476     return SQ_ERROR;
477   }
478   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
479   const SQChar* arg0;
480   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
481     sq_throwerror(vm, _SC("Argument 1 not a string"));
482     return SQ_ERROR;
483   }
484
485   try {
486     _this->set_action(arg0);
487
488     return 0;
489
490   } catch(std::exception& e) {
491     sq_throwerror(vm, e.what());
492     return SQ_ERROR;
493   } catch(...) {
494     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_action'"));
495     return SQ_ERROR;
496   }
497
498 }
499
500 static SQInteger ScriptedObject_get_action_wrapper(HSQUIRRELVM vm)
501 {
502   SQUserPointer data;
503   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
504     sq_throwerror(vm, _SC("'get_action' called without instance"));
505     return SQ_ERROR;
506   }
507   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
508
509   try {
510     std::string return_value = _this->get_action();
511
512     sq_pushstring(vm, return_value.c_str(), return_value.size());
513     return 1;
514
515   } catch(std::exception& e) {
516     sq_throwerror(vm, e.what());
517     return SQ_ERROR;
518   } catch(...) {
519     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_action'"));
520     return SQ_ERROR;
521   }
522
523 }
524
525 static SQInteger ScriptedObject_move_wrapper(HSQUIRRELVM vm)
526 {
527   SQUserPointer data;
528   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
529     sq_throwerror(vm, _SC("'move' called without instance"));
530     return SQ_ERROR;
531   }
532   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
533   SQFloat arg0;
534   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
535     sq_throwerror(vm, _SC("Argument 1 not a float"));
536     return SQ_ERROR;
537   }
538   SQFloat arg1;
539   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
540     sq_throwerror(vm, _SC("Argument 2 not a float"));
541     return SQ_ERROR;
542   }
543
544   try {
545     _this->move(static_cast<float> (arg0), static_cast<float> (arg1));
546
547     return 0;
548
549   } catch(std::exception& e) {
550     sq_throwerror(vm, e.what());
551     return SQ_ERROR;
552   } catch(...) {
553     sq_throwerror(vm, _SC("Unexpected exception while executing function 'move'"));
554     return SQ_ERROR;
555   }
556
557 }
558
559 static SQInteger ScriptedObject_set_pos_wrapper(HSQUIRRELVM vm)
560 {
561   SQUserPointer data;
562   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
563     sq_throwerror(vm, _SC("'set_pos' called without instance"));
564     return SQ_ERROR;
565   }
566   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
567   SQFloat arg0;
568   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
569     sq_throwerror(vm, _SC("Argument 1 not a float"));
570     return SQ_ERROR;
571   }
572   SQFloat arg1;
573   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
574     sq_throwerror(vm, _SC("Argument 2 not a float"));
575     return SQ_ERROR;
576   }
577
578   try {
579     _this->set_pos(static_cast<float> (arg0), static_cast<float> (arg1));
580
581     return 0;
582
583   } catch(std::exception& e) {
584     sq_throwerror(vm, e.what());
585     return SQ_ERROR;
586   } catch(...) {
587     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
588     return SQ_ERROR;
589   }
590
591 }
592
593 static SQInteger ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM vm)
594 {
595   SQUserPointer data;
596   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
597     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
598     return SQ_ERROR;
599   }
600   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
601
602   try {
603     float return_value = _this->get_pos_x();
604
605     sq_pushfloat(vm, return_value);
606     return 1;
607
608   } catch(std::exception& e) {
609     sq_throwerror(vm, e.what());
610     return SQ_ERROR;
611   } catch(...) {
612     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
613     return SQ_ERROR;
614   }
615
616 }
617
618 static SQInteger ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM vm)
619 {
620   SQUserPointer data;
621   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
622     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
623     return SQ_ERROR;
624   }
625   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
626
627   try {
628     float return_value = _this->get_pos_y();
629
630     sq_pushfloat(vm, return_value);
631     return 1;
632
633   } catch(std::exception& e) {
634     sq_throwerror(vm, e.what());
635     return SQ_ERROR;
636   } catch(...) {
637     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
638     return SQ_ERROR;
639   }
640
641 }
642
643 static SQInteger ScriptedObject_set_velocity_wrapper(HSQUIRRELVM vm)
644 {
645   SQUserPointer data;
646   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
647     sq_throwerror(vm, _SC("'set_velocity' called without instance"));
648     return SQ_ERROR;
649   }
650   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
651   SQFloat arg0;
652   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
653     sq_throwerror(vm, _SC("Argument 1 not a float"));
654     return SQ_ERROR;
655   }
656   SQFloat arg1;
657   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
658     sq_throwerror(vm, _SC("Argument 2 not a float"));
659     return SQ_ERROR;
660   }
661
662   try {
663     _this->set_velocity(static_cast<float> (arg0), static_cast<float> (arg1));
664
665     return 0;
666
667   } catch(std::exception& e) {
668     sq_throwerror(vm, e.what());
669     return SQ_ERROR;
670   } catch(...) {
671     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_velocity'"));
672     return SQ_ERROR;
673   }
674
675 }
676
677 static SQInteger ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM vm)
678 {
679   SQUserPointer data;
680   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
681     sq_throwerror(vm, _SC("'get_velocity_x' called without instance"));
682     return SQ_ERROR;
683   }
684   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
685
686   try {
687     float return_value = _this->get_velocity_x();
688
689     sq_pushfloat(vm, return_value);
690     return 1;
691
692   } catch(std::exception& e) {
693     sq_throwerror(vm, e.what());
694     return SQ_ERROR;
695   } catch(...) {
696     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_x'"));
697     return SQ_ERROR;
698   }
699
700 }
701
702 static SQInteger ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM vm)
703 {
704   SQUserPointer data;
705   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
706     sq_throwerror(vm, _SC("'get_velocity_y' called without instance"));
707     return SQ_ERROR;
708   }
709   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
710
711   try {
712     float return_value = _this->get_velocity_y();
713
714     sq_pushfloat(vm, return_value);
715     return 1;
716
717   } catch(std::exception& e) {
718     sq_throwerror(vm, e.what());
719     return SQ_ERROR;
720   } catch(...) {
721     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_y'"));
722     return SQ_ERROR;
723   }
724
725 }
726
727 static SQInteger ScriptedObject_set_visible_wrapper(HSQUIRRELVM vm)
728 {
729   SQUserPointer data;
730   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
731     sq_throwerror(vm, _SC("'set_visible' called without instance"));
732     return SQ_ERROR;
733   }
734   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
735   SQBool arg0;
736   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
737     sq_throwerror(vm, _SC("Argument 1 not a bool"));
738     return SQ_ERROR;
739   }
740
741   try {
742     _this->set_visible(arg0 == SQTrue);
743
744     return 0;
745
746   } catch(std::exception& e) {
747     sq_throwerror(vm, e.what());
748     return SQ_ERROR;
749   } catch(...) {
750     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
751     return SQ_ERROR;
752   }
753
754 }
755
756 static SQInteger ScriptedObject_is_visible_wrapper(HSQUIRRELVM vm)
757 {
758   SQUserPointer data;
759   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
760     sq_throwerror(vm, _SC("'is_visible' called without instance"));
761     return SQ_ERROR;
762   }
763   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
764
765   try {
766     bool return_value = _this->is_visible();
767
768     sq_pushbool(vm, return_value);
769     return 1;
770
771   } catch(std::exception& e) {
772     sq_throwerror(vm, e.what());
773     return SQ_ERROR;
774   } catch(...) {
775     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_visible'"));
776     return SQ_ERROR;
777   }
778
779 }
780
781 static SQInteger ScriptedObject_set_solid_wrapper(HSQUIRRELVM vm)
782 {
783   SQUserPointer data;
784   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
785     sq_throwerror(vm, _SC("'set_solid' called without instance"));
786     return SQ_ERROR;
787   }
788   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
789   SQBool arg0;
790   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
791     sq_throwerror(vm, _SC("Argument 1 not a bool"));
792     return SQ_ERROR;
793   }
794
795   try {
796     _this->set_solid(arg0 == SQTrue);
797
798     return 0;
799
800   } catch(std::exception& e) {
801     sq_throwerror(vm, e.what());
802     return SQ_ERROR;
803   } catch(...) {
804     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_solid'"));
805     return SQ_ERROR;
806   }
807
808 }
809
810 static SQInteger ScriptedObject_is_solid_wrapper(HSQUIRRELVM vm)
811 {
812   SQUserPointer data;
813   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
814     sq_throwerror(vm, _SC("'is_solid' called without instance"));
815     return SQ_ERROR;
816   }
817   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
818
819   try {
820     bool return_value = _this->is_solid();
821
822     sq_pushbool(vm, return_value);
823     return 1;
824
825   } catch(std::exception& e) {
826     sq_throwerror(vm, e.what());
827     return SQ_ERROR;
828   } catch(...) {
829     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_solid'"));
830     return SQ_ERROR;
831   }
832
833 }
834
835 static SQInteger ScriptedObject_get_name_wrapper(HSQUIRRELVM vm)
836 {
837   SQUserPointer data;
838   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
839     sq_throwerror(vm, _SC("'get_name' called without instance"));
840     return SQ_ERROR;
841   }
842   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (data);
843
844   try {
845     std::string return_value = _this->get_name();
846
847     sq_pushstring(vm, return_value.c_str(), return_value.size());
848     return 1;
849
850   } catch(std::exception& e) {
851     sq_throwerror(vm, e.what());
852     return SQ_ERROR;
853   } catch(...) {
854     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_name'"));
855     return SQ_ERROR;
856   }
857
858 }
859
860 static SQInteger Text_release_hook(SQUserPointer ptr, SQInteger )
861 {
862   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
863   delete _this;
864   return 0;
865 }
866
867 static SQInteger Text_set_text_wrapper(HSQUIRRELVM vm)
868 {
869   SQUserPointer data;
870   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
871     sq_throwerror(vm, _SC("'set_text' called without instance"));
872     return SQ_ERROR;
873   }
874   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (data);
875   const SQChar* arg0;
876   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
877     sq_throwerror(vm, _SC("Argument 1 not a string"));
878     return SQ_ERROR;
879   }
880
881   try {
882     _this->set_text(arg0);
883
884     return 0;
885
886   } catch(std::exception& e) {
887     sq_throwerror(vm, e.what());
888     return SQ_ERROR;
889   } catch(...) {
890     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_text'"));
891     return SQ_ERROR;
892   }
893
894 }
895
896 static SQInteger Text_set_font_wrapper(HSQUIRRELVM vm)
897 {
898   SQUserPointer data;
899   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
900     sq_throwerror(vm, _SC("'set_font' called without instance"));
901     return SQ_ERROR;
902   }
903   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (data);
904   const SQChar* arg0;
905   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
906     sq_throwerror(vm, _SC("Argument 1 not a string"));
907     return SQ_ERROR;
908   }
909
910   try {
911     _this->set_font(arg0);
912
913     return 0;
914
915   } catch(std::exception& e) {
916     sq_throwerror(vm, e.what());
917     return SQ_ERROR;
918   } catch(...) {
919     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_font'"));
920     return SQ_ERROR;
921   }
922
923 }
924
925 static SQInteger Text_fade_in_wrapper(HSQUIRRELVM vm)
926 {
927   SQUserPointer data;
928   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
929     sq_throwerror(vm, _SC("'fade_in' called without instance"));
930     return SQ_ERROR;
931   }
932   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (data);
933   SQFloat arg0;
934   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
935     sq_throwerror(vm, _SC("Argument 1 not a float"));
936     return SQ_ERROR;
937   }
938
939   try {
940     _this->fade_in(static_cast<float> (arg0));
941
942     return 0;
943
944   } catch(std::exception& e) {
945     sq_throwerror(vm, e.what());
946     return SQ_ERROR;
947   } catch(...) {
948     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
949     return SQ_ERROR;
950   }
951
952 }
953
954 static SQInteger Text_fade_out_wrapper(HSQUIRRELVM vm)
955 {
956   SQUserPointer data;
957   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
958     sq_throwerror(vm, _SC("'fade_out' called without instance"));
959     return SQ_ERROR;
960   }
961   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (data);
962   SQFloat arg0;
963   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
964     sq_throwerror(vm, _SC("Argument 1 not a float"));
965     return SQ_ERROR;
966   }
967
968   try {
969     _this->fade_out(static_cast<float> (arg0));
970
971     return 0;
972
973   } catch(std::exception& e) {
974     sq_throwerror(vm, e.what());
975     return SQ_ERROR;
976   } catch(...) {
977     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
978     return SQ_ERROR;
979   }
980
981 }
982
983 static SQInteger Text_set_visible_wrapper(HSQUIRRELVM vm)
984 {
985   SQUserPointer data;
986   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
987     sq_throwerror(vm, _SC("'set_visible' called without instance"));
988     return SQ_ERROR;
989   }
990   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (data);
991   SQBool arg0;
992   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
993     sq_throwerror(vm, _SC("Argument 1 not a bool"));
994     return SQ_ERROR;
995   }
996
997   try {
998     _this->set_visible(arg0 == SQTrue);
999
1000     return 0;
1001
1002   } catch(std::exception& e) {
1003     sq_throwerror(vm, e.what());
1004     return SQ_ERROR;
1005   } catch(...) {
1006     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1007     return SQ_ERROR;
1008   }
1009
1010 }
1011
1012 static SQInteger Text_set_centered_wrapper(HSQUIRRELVM vm)
1013 {
1014   SQUserPointer data;
1015   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1016     sq_throwerror(vm, _SC("'set_centered' called without instance"));
1017     return SQ_ERROR;
1018   }
1019   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (data);
1020   SQBool arg0;
1021   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1022     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1023     return SQ_ERROR;
1024   }
1025
1026   try {
1027     _this->set_centered(arg0 == SQTrue);
1028
1029     return 0;
1030
1031   } catch(std::exception& e) {
1032     sq_throwerror(vm, e.what());
1033     return SQ_ERROR;
1034   } catch(...) {
1035     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_centered'"));
1036     return SQ_ERROR;
1037   }
1038
1039 }
1040
1041 static SQInteger Player_release_hook(SQUserPointer ptr, SQInteger )
1042 {
1043   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
1044   delete _this;
1045   return 0;
1046 }
1047
1048 static SQInteger Player_add_bonus_wrapper(HSQUIRRELVM vm)
1049 {
1050   SQUserPointer data;
1051   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1052     sq_throwerror(vm, _SC("'add_bonus' called without instance"));
1053     return SQ_ERROR;
1054   }
1055   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1056   const SQChar* arg0;
1057   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1058     sq_throwerror(vm, _SC("Argument 1 not a string"));
1059     return SQ_ERROR;
1060   }
1061
1062   try {
1063     bool return_value = _this->add_bonus(arg0);
1064
1065     sq_pushbool(vm, return_value);
1066     return 1;
1067
1068   } catch(std::exception& e) {
1069     sq_throwerror(vm, e.what());
1070     return SQ_ERROR;
1071   } catch(...) {
1072     sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_bonus'"));
1073     return SQ_ERROR;
1074   }
1075
1076 }
1077
1078 static SQInteger Player_add_coins_wrapper(HSQUIRRELVM vm)
1079 {
1080   SQUserPointer data;
1081   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1082     sq_throwerror(vm, _SC("'add_coins' called without instance"));
1083     return SQ_ERROR;
1084   }
1085   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1086   SQInteger arg0;
1087   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1088     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1089     return SQ_ERROR;
1090   }
1091
1092   try {
1093     _this->add_coins(static_cast<int> (arg0));
1094
1095     return 0;
1096
1097   } catch(std::exception& e) {
1098     sq_throwerror(vm, e.what());
1099     return SQ_ERROR;
1100   } catch(...) {
1101     sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_coins'"));
1102     return SQ_ERROR;
1103   }
1104
1105 }
1106
1107 static SQInteger Player_make_invincible_wrapper(HSQUIRRELVM vm)
1108 {
1109   SQUserPointer data;
1110   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1111     sq_throwerror(vm, _SC("'make_invincible' called without instance"));
1112     return SQ_ERROR;
1113   }
1114   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1115
1116   try {
1117     _this->make_invincible();
1118
1119     return 0;
1120
1121   } catch(std::exception& e) {
1122     sq_throwerror(vm, e.what());
1123     return SQ_ERROR;
1124   } catch(...) {
1125     sq_throwerror(vm, _SC("Unexpected exception while executing function 'make_invincible'"));
1126     return SQ_ERROR;
1127   }
1128
1129 }
1130
1131 static SQInteger Player_deactivate_wrapper(HSQUIRRELVM vm)
1132 {
1133   SQUserPointer data;
1134   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1135     sq_throwerror(vm, _SC("'deactivate' called without instance"));
1136     return SQ_ERROR;
1137   }
1138   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1139
1140   try {
1141     _this->deactivate();
1142
1143     return 0;
1144
1145   } catch(std::exception& e) {
1146     sq_throwerror(vm, e.what());
1147     return SQ_ERROR;
1148   } catch(...) {
1149     sq_throwerror(vm, _SC("Unexpected exception while executing function 'deactivate'"));
1150     return SQ_ERROR;
1151   }
1152
1153 }
1154
1155 static SQInteger Player_activate_wrapper(HSQUIRRELVM vm)
1156 {
1157   SQUserPointer data;
1158   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1159     sq_throwerror(vm, _SC("'activate' called without instance"));
1160     return SQ_ERROR;
1161   }
1162   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1163
1164   try {
1165     _this->activate();
1166
1167     return 0;
1168
1169   } catch(std::exception& e) {
1170     sq_throwerror(vm, e.what());
1171     return SQ_ERROR;
1172   } catch(...) {
1173     sq_throwerror(vm, _SC("Unexpected exception while executing function 'activate'"));
1174     return SQ_ERROR;
1175   }
1176
1177 }
1178
1179 static SQInteger Player_walk_wrapper(HSQUIRRELVM vm)
1180 {
1181   SQUserPointer data;
1182   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1183     sq_throwerror(vm, _SC("'walk' called without instance"));
1184     return SQ_ERROR;
1185   }
1186   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1187   SQFloat arg0;
1188   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1189     sq_throwerror(vm, _SC("Argument 1 not a float"));
1190     return SQ_ERROR;
1191   }
1192
1193   try {
1194     _this->walk(static_cast<float> (arg0));
1195
1196     return 0;
1197
1198   } catch(std::exception& e) {
1199     sq_throwerror(vm, e.what());
1200     return SQ_ERROR;
1201   } catch(...) {
1202     sq_throwerror(vm, _SC("Unexpected exception while executing function 'walk'"));
1203     return SQ_ERROR;
1204   }
1205
1206 }
1207
1208 static SQInteger Player_set_visible_wrapper(HSQUIRRELVM vm)
1209 {
1210   SQUserPointer data;
1211   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1212     sq_throwerror(vm, _SC("'set_visible' called without instance"));
1213     return SQ_ERROR;
1214   }
1215   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1216   SQBool arg0;
1217   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1218     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1219     return SQ_ERROR;
1220   }
1221
1222   try {
1223     _this->set_visible(arg0 == SQTrue);
1224
1225     return 0;
1226
1227   } catch(std::exception& e) {
1228     sq_throwerror(vm, e.what());
1229     return SQ_ERROR;
1230   } catch(...) {
1231     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1232     return SQ_ERROR;
1233   }
1234
1235 }
1236
1237 static SQInteger Player_get_visible_wrapper(HSQUIRRELVM vm)
1238 {
1239   SQUserPointer data;
1240   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1241     sq_throwerror(vm, _SC("'get_visible' called without instance"));
1242     return SQ_ERROR;
1243   }
1244   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1245
1246   try {
1247     bool return_value = _this->get_visible();
1248
1249     sq_pushbool(vm, return_value);
1250     return 1;
1251
1252   } catch(std::exception& e) {
1253     sq_throwerror(vm, e.what());
1254     return SQ_ERROR;
1255   } catch(...) {
1256     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1257     return SQ_ERROR;
1258   }
1259
1260 }
1261
1262 static SQInteger Player_kill_wrapper(HSQUIRRELVM vm)
1263 {
1264   SQUserPointer data;
1265   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1266     sq_throwerror(vm, _SC("'kill' called without instance"));
1267     return SQ_ERROR;
1268   }
1269   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1270   SQBool arg0;
1271   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1272     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1273     return SQ_ERROR;
1274   }
1275
1276   try {
1277     _this->kill(arg0 == SQTrue);
1278
1279     return 0;
1280
1281   } catch(std::exception& e) {
1282     sq_throwerror(vm, e.what());
1283     return SQ_ERROR;
1284   } catch(...) {
1285     sq_throwerror(vm, _SC("Unexpected exception while executing function 'kill'"));
1286     return SQ_ERROR;
1287   }
1288
1289 }
1290
1291 static SQInteger Player_set_ghost_mode_wrapper(HSQUIRRELVM vm)
1292 {
1293   SQUserPointer data;
1294   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1295     sq_throwerror(vm, _SC("'set_ghost_mode' called without instance"));
1296     return SQ_ERROR;
1297   }
1298   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1299   SQBool arg0;
1300   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1301     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1302     return SQ_ERROR;
1303   }
1304
1305   try {
1306     _this->set_ghost_mode(arg0 == SQTrue);
1307
1308     return 0;
1309
1310   } catch(std::exception& e) {
1311     sq_throwerror(vm, e.what());
1312     return SQ_ERROR;
1313   } catch(...) {
1314     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_ghost_mode'"));
1315     return SQ_ERROR;
1316   }
1317
1318 }
1319
1320 static SQInteger Player_get_ghost_mode_wrapper(HSQUIRRELVM vm)
1321 {
1322   SQUserPointer data;
1323   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1324     sq_throwerror(vm, _SC("'get_ghost_mode' called without instance"));
1325     return SQ_ERROR;
1326   }
1327   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1328
1329   try {
1330     bool return_value = _this->get_ghost_mode();
1331
1332     sq_pushbool(vm, return_value);
1333     return 1;
1334
1335   } catch(std::exception& e) {
1336     sq_throwerror(vm, e.what());
1337     return SQ_ERROR;
1338   } catch(...) {
1339     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_ghost_mode'"));
1340     return SQ_ERROR;
1341   }
1342
1343 }
1344
1345 static SQInteger Player_do_cheer_wrapper(HSQUIRRELVM vm)
1346 {
1347   SQUserPointer data;
1348   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1349     sq_throwerror(vm, _SC("'do_cheer' called without instance"));
1350     return SQ_ERROR;
1351   }
1352   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1353
1354   try {
1355     _this->do_cheer();
1356
1357     return 0;
1358
1359   } catch(std::exception& e) {
1360     sq_throwerror(vm, e.what());
1361     return SQ_ERROR;
1362   } catch(...) {
1363     sq_throwerror(vm, _SC("Unexpected exception while executing function 'do_cheer'"));
1364     return SQ_ERROR;
1365   }
1366
1367 }
1368
1369 static SQInteger Player_do_duck_wrapper(HSQUIRRELVM vm)
1370 {
1371   SQUserPointer data;
1372   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1373     sq_throwerror(vm, _SC("'do_duck' called without instance"));
1374     return SQ_ERROR;
1375   }
1376   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1377
1378   try {
1379     _this->do_duck();
1380
1381     return 0;
1382
1383   } catch(std::exception& e) {
1384     sq_throwerror(vm, e.what());
1385     return SQ_ERROR;
1386   } catch(...) {
1387     sq_throwerror(vm, _SC("Unexpected exception while executing function 'do_duck'"));
1388     return SQ_ERROR;
1389   }
1390
1391 }
1392
1393 static SQInteger Player_do_standup_wrapper(HSQUIRRELVM vm)
1394 {
1395   SQUserPointer data;
1396   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1397     sq_throwerror(vm, _SC("'do_standup' called without instance"));
1398     return SQ_ERROR;
1399   }
1400   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1401
1402   try {
1403     _this->do_standup();
1404
1405     return 0;
1406
1407   } catch(std::exception& e) {
1408     sq_throwerror(vm, e.what());
1409     return SQ_ERROR;
1410   } catch(...) {
1411     sq_throwerror(vm, _SC("Unexpected exception while executing function 'do_standup'"));
1412     return SQ_ERROR;
1413   }
1414
1415 }
1416
1417 static SQInteger Player_do_backflip_wrapper(HSQUIRRELVM vm)
1418 {
1419   SQUserPointer data;
1420   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1421     sq_throwerror(vm, _SC("'do_backflip' called without instance"));
1422     return SQ_ERROR;
1423   }
1424   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1425
1426   try {
1427     _this->do_backflip();
1428
1429     return 0;
1430
1431   } catch(std::exception& e) {
1432     sq_throwerror(vm, e.what());
1433     return SQ_ERROR;
1434   } catch(...) {
1435     sq_throwerror(vm, _SC("Unexpected exception while executing function 'do_backflip'"));
1436     return SQ_ERROR;
1437   }
1438
1439 }
1440
1441 static SQInteger Player_do_jump_wrapper(HSQUIRRELVM vm)
1442 {
1443   SQUserPointer data;
1444   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1445     sq_throwerror(vm, _SC("'do_jump' called without instance"));
1446     return SQ_ERROR;
1447   }
1448   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1449   SQFloat arg0;
1450   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1451     sq_throwerror(vm, _SC("Argument 1 not a float"));
1452     return SQ_ERROR;
1453   }
1454
1455   try {
1456     _this->do_jump(static_cast<float> (arg0));
1457
1458     return 0;
1459
1460   } catch(std::exception& e) {
1461     sq_throwerror(vm, e.what());
1462     return SQ_ERROR;
1463   } catch(...) {
1464     sq_throwerror(vm, _SC("Unexpected exception while executing function 'do_jump'"));
1465     return SQ_ERROR;
1466   }
1467
1468 }
1469
1470 static SQInteger Player_trigger_sequence_wrapper(HSQUIRRELVM vm)
1471 {
1472   SQUserPointer data;
1473   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1474     sq_throwerror(vm, _SC("'trigger_sequence' called without instance"));
1475     return SQ_ERROR;
1476   }
1477   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (data);
1478   const SQChar* arg0;
1479   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1480     sq_throwerror(vm, _SC("Argument 1 not a string"));
1481     return SQ_ERROR;
1482   }
1483
1484   try {
1485     _this->trigger_sequence(arg0);
1486
1487     return 0;
1488
1489   } catch(std::exception& e) {
1490     sq_throwerror(vm, e.what());
1491     return SQ_ERROR;
1492   } catch(...) {
1493     sq_throwerror(vm, _SC("Unexpected exception while executing function 'trigger_sequence'"));
1494     return SQ_ERROR;
1495   }
1496
1497 }
1498
1499 static SQInteger FloatingImage_release_hook(SQUserPointer ptr, SQInteger )
1500 {
1501   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (ptr);
1502   delete _this;
1503   return 0;
1504 }
1505
1506 static SQInteger FloatingImage_constructor_wrapper(HSQUIRRELVM vm)
1507 {
1508   const SQChar* arg0;
1509   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1510     sq_throwerror(vm, _SC("Argument 1 not a string"));
1511     return SQ_ERROR;
1512   }
1513
1514   try {
1515     Scripting::FloatingImage* _this = new Scripting::FloatingImage(arg0);
1516   if(SQ_FAILED(sq_setinstanceup(vm, 1, _this))) {
1517     sq_throwerror(vm, _SC("Couldn't setup instance of 'FloatingImage' class"));
1518     return SQ_ERROR;
1519   }
1520   sq_setreleasehook(vm, 1, FloatingImage_release_hook);
1521
1522     return 0;
1523
1524   } catch(std::exception& e) {
1525     sq_throwerror(vm, e.what());
1526     return SQ_ERROR;
1527   } catch(...) {
1528     sq_throwerror(vm, _SC("Unexpected exception while executing function 'constructor'"));
1529     return SQ_ERROR;
1530   }
1531
1532 }
1533
1534 static SQInteger FloatingImage_set_layer_wrapper(HSQUIRRELVM vm)
1535 {
1536   SQUserPointer data;
1537   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1538     sq_throwerror(vm, _SC("'set_layer' called without instance"));
1539     return SQ_ERROR;
1540   }
1541   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1542   SQInteger arg0;
1543   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1544     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1545     return SQ_ERROR;
1546   }
1547
1548   try {
1549     _this->set_layer(static_cast<int> (arg0));
1550
1551     return 0;
1552
1553   } catch(std::exception& e) {
1554     sq_throwerror(vm, e.what());
1555     return SQ_ERROR;
1556   } catch(...) {
1557     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_layer'"));
1558     return SQ_ERROR;
1559   }
1560
1561 }
1562
1563 static SQInteger FloatingImage_get_layer_wrapper(HSQUIRRELVM vm)
1564 {
1565   SQUserPointer data;
1566   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1567     sq_throwerror(vm, _SC("'get_layer' called without instance"));
1568     return SQ_ERROR;
1569   }
1570   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1571
1572   try {
1573     int return_value = _this->get_layer();
1574
1575     sq_pushinteger(vm, return_value);
1576     return 1;
1577
1578   } catch(std::exception& e) {
1579     sq_throwerror(vm, e.what());
1580     return SQ_ERROR;
1581   } catch(...) {
1582     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_layer'"));
1583     return SQ_ERROR;
1584   }
1585
1586 }
1587
1588 static SQInteger FloatingImage_set_pos_wrapper(HSQUIRRELVM vm)
1589 {
1590   SQUserPointer data;
1591   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1592     sq_throwerror(vm, _SC("'set_pos' called without instance"));
1593     return SQ_ERROR;
1594   }
1595   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1596   SQFloat arg0;
1597   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1598     sq_throwerror(vm, _SC("Argument 1 not a float"));
1599     return SQ_ERROR;
1600   }
1601   SQFloat arg1;
1602   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
1603     sq_throwerror(vm, _SC("Argument 2 not a float"));
1604     return SQ_ERROR;
1605   }
1606
1607   try {
1608     _this->set_pos(static_cast<float> (arg0), static_cast<float> (arg1));
1609
1610     return 0;
1611
1612   } catch(std::exception& e) {
1613     sq_throwerror(vm, e.what());
1614     return SQ_ERROR;
1615   } catch(...) {
1616     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
1617     return SQ_ERROR;
1618   }
1619
1620 }
1621
1622 static SQInteger FloatingImage_get_pos_x_wrapper(HSQUIRRELVM vm)
1623 {
1624   SQUserPointer data;
1625   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1626     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
1627     return SQ_ERROR;
1628   }
1629   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1630
1631   try {
1632     float return_value = _this->get_pos_x();
1633
1634     sq_pushfloat(vm, return_value);
1635     return 1;
1636
1637   } catch(std::exception& e) {
1638     sq_throwerror(vm, e.what());
1639     return SQ_ERROR;
1640   } catch(...) {
1641     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
1642     return SQ_ERROR;
1643   }
1644
1645 }
1646
1647 static SQInteger FloatingImage_get_pos_y_wrapper(HSQUIRRELVM vm)
1648 {
1649   SQUserPointer data;
1650   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1651     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
1652     return SQ_ERROR;
1653   }
1654   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1655
1656   try {
1657     float return_value = _this->get_pos_y();
1658
1659     sq_pushfloat(vm, return_value);
1660     return 1;
1661
1662   } catch(std::exception& e) {
1663     sq_throwerror(vm, e.what());
1664     return SQ_ERROR;
1665   } catch(...) {
1666     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
1667     return SQ_ERROR;
1668   }
1669
1670 }
1671
1672 static SQInteger FloatingImage_set_anchor_point_wrapper(HSQUIRRELVM vm)
1673 {
1674   SQUserPointer data;
1675   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1676     sq_throwerror(vm, _SC("'set_anchor_point' called without instance"));
1677     return SQ_ERROR;
1678   }
1679   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1680   SQInteger arg0;
1681   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1682     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1683     return SQ_ERROR;
1684   }
1685
1686   try {
1687     _this->set_anchor_point(static_cast<int> (arg0));
1688
1689     return 0;
1690
1691   } catch(std::exception& e) {
1692     sq_throwerror(vm, e.what());
1693     return SQ_ERROR;
1694   } catch(...) {
1695     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_anchor_point'"));
1696     return SQ_ERROR;
1697   }
1698
1699 }
1700
1701 static SQInteger FloatingImage_get_anchor_point_wrapper(HSQUIRRELVM vm)
1702 {
1703   SQUserPointer data;
1704   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1705     sq_throwerror(vm, _SC("'get_anchor_point' called without instance"));
1706     return SQ_ERROR;
1707   }
1708   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1709
1710   try {
1711     int return_value = _this->get_anchor_point();
1712
1713     sq_pushinteger(vm, return_value);
1714     return 1;
1715
1716   } catch(std::exception& e) {
1717     sq_throwerror(vm, e.what());
1718     return SQ_ERROR;
1719   } catch(...) {
1720     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_anchor_point'"));
1721     return SQ_ERROR;
1722   }
1723
1724 }
1725
1726 static SQInteger FloatingImage_set_visible_wrapper(HSQUIRRELVM vm)
1727 {
1728   SQUserPointer data;
1729   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1730     sq_throwerror(vm, _SC("'set_visible' called without instance"));
1731     return SQ_ERROR;
1732   }
1733   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1734   SQBool arg0;
1735   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1736     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1737     return SQ_ERROR;
1738   }
1739
1740   try {
1741     _this->set_visible(arg0 == SQTrue);
1742
1743     return 0;
1744
1745   } catch(std::exception& e) {
1746     sq_throwerror(vm, e.what());
1747     return SQ_ERROR;
1748   } catch(...) {
1749     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1750     return SQ_ERROR;
1751   }
1752
1753 }
1754
1755 static SQInteger FloatingImage_get_visible_wrapper(HSQUIRRELVM vm)
1756 {
1757   SQUserPointer data;
1758   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1759     sq_throwerror(vm, _SC("'get_visible' called without instance"));
1760     return SQ_ERROR;
1761   }
1762   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1763
1764   try {
1765     bool return_value = _this->get_visible();
1766
1767     sq_pushbool(vm, return_value);
1768     return 1;
1769
1770   } catch(std::exception& e) {
1771     sq_throwerror(vm, e.what());
1772     return SQ_ERROR;
1773   } catch(...) {
1774     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1775     return SQ_ERROR;
1776   }
1777
1778 }
1779
1780 static SQInteger FloatingImage_set_action_wrapper(HSQUIRRELVM vm)
1781 {
1782   SQUserPointer data;
1783   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1784     sq_throwerror(vm, _SC("'set_action' called without instance"));
1785     return SQ_ERROR;
1786   }
1787   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1788   const SQChar* arg0;
1789   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1790     sq_throwerror(vm, _SC("Argument 1 not a string"));
1791     return SQ_ERROR;
1792   }
1793
1794   try {
1795     _this->set_action(arg0);
1796
1797     return 0;
1798
1799   } catch(std::exception& e) {
1800     sq_throwerror(vm, e.what());
1801     return SQ_ERROR;
1802   } catch(...) {
1803     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_action'"));
1804     return SQ_ERROR;
1805   }
1806
1807 }
1808
1809 static SQInteger FloatingImage_get_action_wrapper(HSQUIRRELVM vm)
1810 {
1811   SQUserPointer data;
1812   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1813     sq_throwerror(vm, _SC("'get_action' called without instance"));
1814     return SQ_ERROR;
1815   }
1816   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1817
1818   try {
1819     std::string return_value = _this->get_action();
1820
1821     sq_pushstring(vm, return_value.c_str(), return_value.size());
1822     return 1;
1823
1824   } catch(std::exception& e) {
1825     sq_throwerror(vm, e.what());
1826     return SQ_ERROR;
1827   } catch(...) {
1828     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_action'"));
1829     return SQ_ERROR;
1830   }
1831
1832 }
1833
1834 static SQInteger FloatingImage_fade_in_wrapper(HSQUIRRELVM vm)
1835 {
1836   SQUserPointer data;
1837   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1838     sq_throwerror(vm, _SC("'fade_in' called without instance"));
1839     return SQ_ERROR;
1840   }
1841   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1842   SQFloat arg0;
1843   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1844     sq_throwerror(vm, _SC("Argument 1 not a float"));
1845     return SQ_ERROR;
1846   }
1847
1848   try {
1849     _this->fade_in(static_cast<float> (arg0));
1850
1851     return 0;
1852
1853   } catch(std::exception& e) {
1854     sq_throwerror(vm, e.what());
1855     return SQ_ERROR;
1856   } catch(...) {
1857     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
1858     return SQ_ERROR;
1859   }
1860
1861 }
1862
1863 static SQInteger FloatingImage_fade_out_wrapper(HSQUIRRELVM vm)
1864 {
1865   SQUserPointer data;
1866   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1867     sq_throwerror(vm, _SC("'fade_out' called without instance"));
1868     return SQ_ERROR;
1869   }
1870   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (data);
1871   SQFloat arg0;
1872   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1873     sq_throwerror(vm, _SC("Argument 1 not a float"));
1874     return SQ_ERROR;
1875   }
1876
1877   try {
1878     _this->fade_out(static_cast<float> (arg0));
1879
1880     return 0;
1881
1882   } catch(std::exception& e) {
1883     sq_throwerror(vm, e.what());
1884     return SQ_ERROR;
1885   } catch(...) {
1886     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
1887     return SQ_ERROR;
1888   }
1889
1890 }
1891
1892 static SQInteger Platform_release_hook(SQUserPointer ptr, SQInteger )
1893 {
1894   Scripting::Platform* _this = reinterpret_cast<Scripting::Platform*> (ptr);
1895   delete _this;
1896   return 0;
1897 }
1898
1899 static SQInteger Platform_goto_node_wrapper(HSQUIRRELVM vm)
1900 {
1901   SQUserPointer data;
1902   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1903     sq_throwerror(vm, _SC("'goto_node' called without instance"));
1904     return SQ_ERROR;
1905   }
1906   Scripting::Platform* _this = reinterpret_cast<Scripting::Platform*> (data);
1907   SQInteger arg0;
1908   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1909     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1910     return SQ_ERROR;
1911   }
1912
1913   try {
1914     _this->goto_node(static_cast<int> (arg0));
1915
1916     return 0;
1917
1918   } catch(std::exception& e) {
1919     sq_throwerror(vm, e.what());
1920     return SQ_ERROR;
1921   } catch(...) {
1922     sq_throwerror(vm, _SC("Unexpected exception while executing function 'goto_node'"));
1923     return SQ_ERROR;
1924   }
1925
1926 }
1927
1928 static SQInteger Platform_start_moving_wrapper(HSQUIRRELVM vm)
1929 {
1930   SQUserPointer data;
1931   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1932     sq_throwerror(vm, _SC("'start_moving' called without instance"));
1933     return SQ_ERROR;
1934   }
1935   Scripting::Platform* _this = reinterpret_cast<Scripting::Platform*> (data);
1936
1937   try {
1938     _this->start_moving();
1939
1940     return 0;
1941
1942   } catch(std::exception& e) {
1943     sq_throwerror(vm, e.what());
1944     return SQ_ERROR;
1945   } catch(...) {
1946     sq_throwerror(vm, _SC("Unexpected exception while executing function 'start_moving'"));
1947     return SQ_ERROR;
1948   }
1949
1950 }
1951
1952 static SQInteger Platform_stop_moving_wrapper(HSQUIRRELVM vm)
1953 {
1954   SQUserPointer data;
1955   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1956     sq_throwerror(vm, _SC("'stop_moving' called without instance"));
1957     return SQ_ERROR;
1958   }
1959   Scripting::Platform* _this = reinterpret_cast<Scripting::Platform*> (data);
1960
1961   try {
1962     _this->stop_moving();
1963
1964     return 0;
1965
1966   } catch(std::exception& e) {
1967     sq_throwerror(vm, e.what());
1968     return SQ_ERROR;
1969   } catch(...) {
1970     sq_throwerror(vm, _SC("Unexpected exception while executing function 'stop_moving'"));
1971     return SQ_ERROR;
1972   }
1973
1974 }
1975
1976 static SQInteger Candle_release_hook(SQUserPointer ptr, SQInteger )
1977 {
1978   Scripting::Candle* _this = reinterpret_cast<Scripting::Candle*> (ptr);
1979   delete _this;
1980   return 0;
1981 }
1982
1983 static SQInteger Candle_get_burning_wrapper(HSQUIRRELVM vm)
1984 {
1985   SQUserPointer data;
1986   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
1987     sq_throwerror(vm, _SC("'get_burning' called without instance"));
1988     return SQ_ERROR;
1989   }
1990   Scripting::Candle* _this = reinterpret_cast<Scripting::Candle*> (data);
1991
1992   try {
1993     bool return_value = _this->get_burning();
1994
1995     sq_pushbool(vm, return_value);
1996     return 1;
1997
1998   } catch(std::exception& e) {
1999     sq_throwerror(vm, e.what());
2000     return SQ_ERROR;
2001   } catch(...) {
2002     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_burning'"));
2003     return SQ_ERROR;
2004   }
2005
2006 }
2007
2008 static SQInteger Candle_set_burning_wrapper(HSQUIRRELVM vm)
2009 {
2010   SQUserPointer data;
2011   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2012     sq_throwerror(vm, _SC("'set_burning' called without instance"));
2013     return SQ_ERROR;
2014   }
2015   Scripting::Candle* _this = reinterpret_cast<Scripting::Candle*> (data);
2016   SQBool arg0;
2017   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
2018     sq_throwerror(vm, _SC("Argument 1 not a bool"));
2019     return SQ_ERROR;
2020   }
2021
2022   try {
2023     _this->set_burning(arg0 == SQTrue);
2024
2025     return 0;
2026
2027   } catch(std::exception& e) {
2028     sq_throwerror(vm, e.what());
2029     return SQ_ERROR;
2030   } catch(...) {
2031     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_burning'"));
2032     return SQ_ERROR;
2033   }
2034
2035 }
2036
2037 static SQInteger Wind_release_hook(SQUserPointer ptr, SQInteger )
2038 {
2039   Scripting::Wind* _this = reinterpret_cast<Scripting::Wind*> (ptr);
2040   delete _this;
2041   return 0;
2042 }
2043
2044 static SQInteger Wind_start_wrapper(HSQUIRRELVM vm)
2045 {
2046   SQUserPointer data;
2047   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2048     sq_throwerror(vm, _SC("'start' called without instance"));
2049     return SQ_ERROR;
2050   }
2051   Scripting::Wind* _this = reinterpret_cast<Scripting::Wind*> (data);
2052
2053   try {
2054     _this->start();
2055
2056     return 0;
2057
2058   } catch(std::exception& e) {
2059     sq_throwerror(vm, e.what());
2060     return SQ_ERROR;
2061   } catch(...) {
2062     sq_throwerror(vm, _SC("Unexpected exception while executing function 'start'"));
2063     return SQ_ERROR;
2064   }
2065
2066 }
2067
2068 static SQInteger Wind_stop_wrapper(HSQUIRRELVM vm)
2069 {
2070   SQUserPointer data;
2071   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2072     sq_throwerror(vm, _SC("'stop' called without instance"));
2073     return SQ_ERROR;
2074   }
2075   Scripting::Wind* _this = reinterpret_cast<Scripting::Wind*> (data);
2076
2077   try {
2078     _this->stop();
2079
2080     return 0;
2081
2082   } catch(std::exception& e) {
2083     sq_throwerror(vm, e.what());
2084     return SQ_ERROR;
2085   } catch(...) {
2086     sq_throwerror(vm, _SC("Unexpected exception while executing function 'stop'"));
2087     return SQ_ERROR;
2088   }
2089
2090 }
2091
2092 static SQInteger AmbientSound_release_hook(SQUserPointer ptr, SQInteger )
2093 {
2094   Scripting::AmbientSound* _this = reinterpret_cast<Scripting::AmbientSound*> (ptr);
2095   delete _this;
2096   return 0;
2097 }
2098
2099 static SQInteger AmbientSound_set_pos_wrapper(HSQUIRRELVM vm)
2100 {
2101   SQUserPointer data;
2102   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2103     sq_throwerror(vm, _SC("'set_pos' called without instance"));
2104     return SQ_ERROR;
2105   }
2106   Scripting::AmbientSound* _this = reinterpret_cast<Scripting::AmbientSound*> (data);
2107   SQFloat arg0;
2108   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
2109     sq_throwerror(vm, _SC("Argument 1 not a float"));
2110     return SQ_ERROR;
2111   }
2112   SQFloat arg1;
2113   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
2114     sq_throwerror(vm, _SC("Argument 2 not a float"));
2115     return SQ_ERROR;
2116   }
2117
2118   try {
2119     _this->set_pos(static_cast<float> (arg0), static_cast<float> (arg1));
2120
2121     return 0;
2122
2123   } catch(std::exception& e) {
2124     sq_throwerror(vm, e.what());
2125     return SQ_ERROR;
2126   } catch(...) {
2127     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
2128     return SQ_ERROR;
2129   }
2130
2131 }
2132
2133 static SQInteger AmbientSound_get_pos_x_wrapper(HSQUIRRELVM vm)
2134 {
2135   SQUserPointer data;
2136   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2137     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
2138     return SQ_ERROR;
2139   }
2140   Scripting::AmbientSound* _this = reinterpret_cast<Scripting::AmbientSound*> (data);
2141
2142   try {
2143     float return_value = _this->get_pos_x();
2144
2145     sq_pushfloat(vm, return_value);
2146     return 1;
2147
2148   } catch(std::exception& e) {
2149     sq_throwerror(vm, e.what());
2150     return SQ_ERROR;
2151   } catch(...) {
2152     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
2153     return SQ_ERROR;
2154   }
2155
2156 }
2157
2158 static SQInteger AmbientSound_get_pos_y_wrapper(HSQUIRRELVM vm)
2159 {
2160   SQUserPointer data;
2161   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2162     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
2163     return SQ_ERROR;
2164   }
2165   Scripting::AmbientSound* _this = reinterpret_cast<Scripting::AmbientSound*> (data);
2166
2167   try {
2168     float return_value = _this->get_pos_y();
2169
2170     sq_pushfloat(vm, return_value);
2171     return 1;
2172
2173   } catch(std::exception& e) {
2174     sq_throwerror(vm, e.what());
2175     return SQ_ERROR;
2176   } catch(...) {
2177     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
2178     return SQ_ERROR;
2179   }
2180
2181 }
2182
2183 static SQInteger Thunderstorm_release_hook(SQUserPointer ptr, SQInteger )
2184 {
2185   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (ptr);
2186   delete _this;
2187   return 0;
2188 }
2189
2190 static SQInteger Thunderstorm_start_wrapper(HSQUIRRELVM vm)
2191 {
2192   SQUserPointer data;
2193   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2194     sq_throwerror(vm, _SC("'start' called without instance"));
2195     return SQ_ERROR;
2196   }
2197   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (data);
2198
2199   try {
2200     _this->start();
2201
2202     return 0;
2203
2204   } catch(std::exception& e) {
2205     sq_throwerror(vm, e.what());
2206     return SQ_ERROR;
2207   } catch(...) {
2208     sq_throwerror(vm, _SC("Unexpected exception while executing function 'start'"));
2209     return SQ_ERROR;
2210   }
2211
2212 }
2213
2214 static SQInteger Thunderstorm_stop_wrapper(HSQUIRRELVM vm)
2215 {
2216   SQUserPointer data;
2217   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2218     sq_throwerror(vm, _SC("'stop' called without instance"));
2219     return SQ_ERROR;
2220   }
2221   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (data);
2222
2223   try {
2224     _this->stop();
2225
2226     return 0;
2227
2228   } catch(std::exception& e) {
2229     sq_throwerror(vm, e.what());
2230     return SQ_ERROR;
2231   } catch(...) {
2232     sq_throwerror(vm, _SC("Unexpected exception while executing function 'stop'"));
2233     return SQ_ERROR;
2234   }
2235
2236 }
2237
2238 static SQInteger Thunderstorm_thunder_wrapper(HSQUIRRELVM vm)
2239 {
2240   SQUserPointer data;
2241   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2242     sq_throwerror(vm, _SC("'thunder' called without instance"));
2243     return SQ_ERROR;
2244   }
2245   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (data);
2246
2247   try {
2248     _this->thunder();
2249
2250     return 0;
2251
2252   } catch(std::exception& e) {
2253     sq_throwerror(vm, e.what());
2254     return SQ_ERROR;
2255   } catch(...) {
2256     sq_throwerror(vm, _SC("Unexpected exception while executing function 'thunder'"));
2257     return SQ_ERROR;
2258   }
2259
2260 }
2261
2262 static SQInteger Thunderstorm_lightning_wrapper(HSQUIRRELVM vm)
2263 {
2264   SQUserPointer data;
2265   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2266     sq_throwerror(vm, _SC("'lightning' called without instance"));
2267     return SQ_ERROR;
2268   }
2269   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (data);
2270
2271   try {
2272     _this->lightning();
2273
2274     return 0;
2275
2276   } catch(std::exception& e) {
2277     sq_throwerror(vm, e.what());
2278     return SQ_ERROR;
2279   } catch(...) {
2280     sq_throwerror(vm, _SC("Unexpected exception while executing function 'lightning'"));
2281     return SQ_ERROR;
2282   }
2283
2284 }
2285
2286 static SQInteger Thunderstorm_flash_wrapper(HSQUIRRELVM vm)
2287 {
2288   SQUserPointer data;
2289   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2290     sq_throwerror(vm, _SC("'flash' called without instance"));
2291     return SQ_ERROR;
2292   }
2293   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (data);
2294
2295   try {
2296     _this->flash();
2297
2298     return 0;
2299
2300   } catch(std::exception& e) {
2301     sq_throwerror(vm, e.what());
2302     return SQ_ERROR;
2303   } catch(...) {
2304     sq_throwerror(vm, _SC("Unexpected exception while executing function 'flash'"));
2305     return SQ_ERROR;
2306   }
2307
2308 }
2309
2310 static SQInteger Thunderstorm_electrify_wrapper(HSQUIRRELVM vm)
2311 {
2312   SQUserPointer data;
2313   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2314     sq_throwerror(vm, _SC("'electrify' called without instance"));
2315     return SQ_ERROR;
2316   }
2317   Scripting::Thunderstorm* _this = reinterpret_cast<Scripting::Thunderstorm*> (data);
2318
2319   try {
2320     _this->electrify();
2321
2322     return 0;
2323
2324   } catch(std::exception& e) {
2325     sq_throwerror(vm, e.what());
2326     return SQ_ERROR;
2327   } catch(...) {
2328     sq_throwerror(vm, _SC("Unexpected exception while executing function 'electrify'"));
2329     return SQ_ERROR;
2330   }
2331
2332 }
2333
2334 static SQInteger TileMap_release_hook(SQUserPointer ptr, SQInteger )
2335 {
2336   Scripting::TileMap* _this = reinterpret_cast<Scripting::TileMap*> (ptr);
2337   delete _this;
2338   return 0;
2339 }
2340
2341 static SQInteger TileMap_goto_node_wrapper(HSQUIRRELVM vm)
2342 {
2343   SQUserPointer data;
2344   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2345     sq_throwerror(vm, _SC("'goto_node' called without instance"));
2346     return SQ_ERROR;
2347   }
2348   Scripting::TileMap* _this = reinterpret_cast<Scripting::TileMap*> (data);
2349   SQInteger arg0;
2350   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
2351     sq_throwerror(vm, _SC("Argument 1 not an integer"));
2352     return SQ_ERROR;
2353   }
2354
2355   try {
2356     _this->goto_node(static_cast<int> (arg0));
2357
2358     return 0;
2359
2360   } catch(std::exception& e) {
2361     sq_throwerror(vm, e.what());
2362     return SQ_ERROR;
2363   } catch(...) {
2364     sq_throwerror(vm, _SC("Unexpected exception while executing function 'goto_node'"));
2365     return SQ_ERROR;
2366   }
2367
2368 }
2369
2370 static SQInteger TileMap_start_moving_wrapper(HSQUIRRELVM vm)
2371 {
2372   SQUserPointer data;
2373   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2374     sq_throwerror(vm, _SC("'start_moving' called without instance"));
2375     return SQ_ERROR;
2376   }
2377   Scripting::TileMap* _this = reinterpret_cast<Scripting::TileMap*> (data);
2378
2379   try {
2380     _this->start_moving();
2381
2382     return 0;
2383
2384   } catch(std::exception& e) {
2385     sq_throwerror(vm, e.what());
2386     return SQ_ERROR;
2387   } catch(...) {
2388     sq_throwerror(vm, _SC("Unexpected exception while executing function 'start_moving'"));
2389     return SQ_ERROR;
2390   }
2391
2392 }
2393
2394 static SQInteger TileMap_stop_moving_wrapper(HSQUIRRELVM vm)
2395 {
2396   SQUserPointer data;
2397   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2398     sq_throwerror(vm, _SC("'stop_moving' called without instance"));
2399     return SQ_ERROR;
2400   }
2401   Scripting::TileMap* _this = reinterpret_cast<Scripting::TileMap*> (data);
2402
2403   try {
2404     _this->stop_moving();
2405
2406     return 0;
2407
2408   } catch(std::exception& e) {
2409     sq_throwerror(vm, e.what());
2410     return SQ_ERROR;
2411   } catch(...) {
2412     sq_throwerror(vm, _SC("Unexpected exception while executing function 'stop_moving'"));
2413     return SQ_ERROR;
2414   }
2415
2416 }
2417
2418 static SQInteger SSector_release_hook(SQUserPointer ptr, SQInteger )
2419 {
2420   Scripting::SSector* _this = reinterpret_cast<Scripting::SSector*> (ptr);
2421   delete _this;
2422   return 0;
2423 }
2424
2425 static SQInteger SSector_set_ambient_light_wrapper(HSQUIRRELVM vm)
2426 {
2427   SQUserPointer data;
2428   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2429     sq_throwerror(vm, _SC("'set_ambient_light' called without instance"));
2430     return SQ_ERROR;
2431   }
2432   Scripting::SSector* _this = reinterpret_cast<Scripting::SSector*> (data);
2433   SQFloat arg0;
2434   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
2435     sq_throwerror(vm, _SC("Argument 1 not a float"));
2436     return SQ_ERROR;
2437   }
2438   SQFloat arg1;
2439   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
2440     sq_throwerror(vm, _SC("Argument 2 not a float"));
2441     return SQ_ERROR;
2442   }
2443   SQFloat arg2;
2444   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
2445     sq_throwerror(vm, _SC("Argument 3 not a float"));
2446     return SQ_ERROR;
2447   }
2448
2449   try {
2450     _this->set_ambient_light(static_cast<float> (arg0), static_cast<float> (arg1), static_cast<float> (arg2));
2451
2452     return 0;
2453
2454   } catch(std::exception& e) {
2455     sq_throwerror(vm, e.what());
2456     return SQ_ERROR;
2457   } catch(...) {
2458     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_ambient_light'"));
2459     return SQ_ERROR;
2460   }
2461
2462 }
2463
2464 static SQInteger SSector_get_ambient_red_wrapper(HSQUIRRELVM vm)
2465 {
2466   SQUserPointer data;
2467   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2468     sq_throwerror(vm, _SC("'get_ambient_red' called without instance"));
2469     return SQ_ERROR;
2470   }
2471   Scripting::SSector* _this = reinterpret_cast<Scripting::SSector*> (data);
2472
2473   try {
2474     float return_value = _this->get_ambient_red();
2475
2476     sq_pushfloat(vm, return_value);
2477     return 1;
2478
2479   } catch(std::exception& e) {
2480     sq_throwerror(vm, e.what());
2481     return SQ_ERROR;
2482   } catch(...) {
2483     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_ambient_red'"));
2484     return SQ_ERROR;
2485   }
2486
2487 }
2488
2489 static SQInteger SSector_get_ambient_green_wrapper(HSQUIRRELVM vm)
2490 {
2491   SQUserPointer data;
2492   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2493     sq_throwerror(vm, _SC("'get_ambient_green' called without instance"));
2494     return SQ_ERROR;
2495   }
2496   Scripting::SSector* _this = reinterpret_cast<Scripting::SSector*> (data);
2497
2498   try {
2499     float return_value = _this->get_ambient_green();
2500
2501     sq_pushfloat(vm, return_value);
2502     return 1;
2503
2504   } catch(std::exception& e) {
2505     sq_throwerror(vm, e.what());
2506     return SQ_ERROR;
2507   } catch(...) {
2508     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_ambient_green'"));
2509     return SQ_ERROR;
2510   }
2511
2512 }
2513
2514 static SQInteger SSector_get_ambient_blue_wrapper(HSQUIRRELVM vm)
2515 {
2516   SQUserPointer data;
2517   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2518     sq_throwerror(vm, _SC("'get_ambient_blue' called without instance"));
2519     return SQ_ERROR;
2520   }
2521   Scripting::SSector* _this = reinterpret_cast<Scripting::SSector*> (data);
2522
2523   try {
2524     float return_value = _this->get_ambient_blue();
2525
2526     sq_pushfloat(vm, return_value);
2527     return 1;
2528
2529   } catch(std::exception& e) {
2530     sq_throwerror(vm, e.what());
2531     return SQ_ERROR;
2532   } catch(...) {
2533     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_ambient_blue'"));
2534     return SQ_ERROR;
2535   }
2536
2537 }
2538
2539 static SQInteger LevelTime_release_hook(SQUserPointer ptr, SQInteger )
2540 {
2541   Scripting::LevelTime* _this = reinterpret_cast<Scripting::LevelTime*> (ptr);
2542   delete _this;
2543   return 0;
2544 }
2545
2546 static SQInteger LevelTime_start_wrapper(HSQUIRRELVM vm)
2547 {
2548   SQUserPointer data;
2549   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2550     sq_throwerror(vm, _SC("'start' called without instance"));
2551     return SQ_ERROR;
2552   }
2553   Scripting::LevelTime* _this = reinterpret_cast<Scripting::LevelTime*> (data);
2554
2555   try {
2556     _this->start();
2557
2558     return 0;
2559
2560   } catch(std::exception& e) {
2561     sq_throwerror(vm, e.what());
2562     return SQ_ERROR;
2563   } catch(...) {
2564     sq_throwerror(vm, _SC("Unexpected exception while executing function 'start'"));
2565     return SQ_ERROR;
2566   }
2567
2568 }
2569
2570 static SQInteger LevelTime_stop_wrapper(HSQUIRRELVM vm)
2571 {
2572   SQUserPointer data;
2573   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2574     sq_throwerror(vm, _SC("'stop' called without instance"));
2575     return SQ_ERROR;
2576   }
2577   Scripting::LevelTime* _this = reinterpret_cast<Scripting::LevelTime*> (data);
2578
2579   try {
2580     _this->stop();
2581
2582     return 0;
2583
2584   } catch(std::exception& e) {
2585     sq_throwerror(vm, e.what());
2586     return SQ_ERROR;
2587   } catch(...) {
2588     sq_throwerror(vm, _SC("Unexpected exception while executing function 'stop'"));
2589     return SQ_ERROR;
2590   }
2591
2592 }
2593
2594 static SQInteger LevelTime_get_time_wrapper(HSQUIRRELVM vm)
2595 {
2596   SQUserPointer data;
2597   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2598     sq_throwerror(vm, _SC("'get_time' called without instance"));
2599     return SQ_ERROR;
2600   }
2601   Scripting::LevelTime* _this = reinterpret_cast<Scripting::LevelTime*> (data);
2602
2603   try {
2604     float return_value = _this->get_time();
2605
2606     sq_pushfloat(vm, return_value);
2607     return 1;
2608
2609   } catch(std::exception& e) {
2610     sq_throwerror(vm, e.what());
2611     return SQ_ERROR;
2612   } catch(...) {
2613     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_time'"));
2614     return SQ_ERROR;
2615   }
2616
2617 }
2618
2619 static SQInteger LevelTime_set_time_wrapper(HSQUIRRELVM vm)
2620 {
2621   SQUserPointer data;
2622   if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {
2623     sq_throwerror(vm, _SC("'set_time' called without instance"));
2624     return SQ_ERROR;
2625   }
2626   Scripting::LevelTime* _this = reinterpret_cast<Scripting::LevelTime*> (data);
2627   SQFloat arg0;
2628   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
2629     sq_throwerror(vm, _SC("Argument 1 not a float"));
2630     return SQ_ERROR;
2631   }
2632
2633   try {
2634     _this->set_time(static_cast<float> (arg0));
2635
2636     return 0;
2637
2638   } catch(std::exception& e) {
2639     sq_throwerror(vm, e.what());
2640     return SQ_ERROR;
2641   } catch(...) {
2642     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_time'"));
2643     return SQ_ERROR;
2644   }
2645
2646 }
2647
2648 static SQInteger display_wrapper(HSQUIRRELVM vm)
2649 {
2650   return Scripting::display(vm);
2651 }
2652
2653 static SQInteger print_stacktrace_wrapper(HSQUIRRELVM vm)
2654 {
2655   HSQUIRRELVM arg0 = vm;
2656
2657   try {
2658     Scripting::print_stacktrace(arg0);
2659
2660     return 0;
2661
2662   } catch(std::exception& e) {
2663     sq_throwerror(vm, e.what());
2664     return SQ_ERROR;
2665   } catch(...) {
2666     sq_throwerror(vm, _SC("Unexpected exception while executing function 'print_stacktrace'"));
2667     return SQ_ERROR;
2668   }
2669
2670 }
2671
2672 static SQInteger get_current_thread_wrapper(HSQUIRRELVM vm)
2673 {
2674   return Scripting::get_current_thread(vm);
2675 }
2676
2677 static SQInteger display_text_file_wrapper(HSQUIRRELVM vm)
2678 {
2679   const SQChar* arg0;
2680   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
2681     sq_throwerror(vm, _SC("Argument 1 not a string"));
2682     return SQ_ERROR;
2683   }
2684
2685   try {
2686     Scripting::display_text_file(arg0);
2687
2688     return 0;
2689
2690   } catch(std::exception& e) {
2691     sq_throwerror(vm, e.what());
2692     return SQ_ERROR;
2693   } catch(...) {
2694     sq_throwerror(vm, _SC("Unexpected exception while executing function 'display_text_file'"));
2695     return SQ_ERROR;
2696   }
2697
2698 }
2699
2700 static SQInteger load_worldmap_wrapper(HSQUIRRELVM vm)
2701 {
2702   const SQChar* arg0;
2703   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
2704     sq_throwerror(vm, _SC("Argument 1 not a string"));
2705     return SQ_ERROR;
2706   }
2707
2708   try {
2709     Scripting::load_worldmap(arg0);
2710
2711     return 0;
2712
2713   } catch(std::exception& e) {
2714     sq_throwerror(vm, e.what());
2715     return SQ_ERROR;
2716   } catch(...) {
2717     sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_worldmap'"));
2718     return SQ_ERROR;
2719   }
2720
2721 }
2722
2723 static SQInteger load_level_wrapper(HSQUIRRELVM vm)
2724 {
2725   const SQChar* arg0;
2726   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
2727     sq_throwerror(vm, _SC("Argument 1 not a string"));
2728     return SQ_ERROR;
2729   }
2730
2731   try {
2732     Scripting::load_level(arg0);
2733
2734     return 0;
2735
2736   } catch(std::exception& e) {
2737     sq_throwerror(vm, e.what());
2738     return SQ_ERROR;
2739   } catch(...) {
2740     sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_level'"));
2741     return SQ_ERROR;
2742   }
2743
2744 }
2745
2746 static SQInteger wait_wrapper(HSQUIRRELVM vm)
2747 {
2748   HSQUIRRELVM arg0 = vm;
2749   SQFloat arg1;
2750   if(SQ_FAILED(sq_getfloat(vm, 2, &arg1))) {
2751     sq_throwerror(vm, _SC("Argument 1 not a float"));
2752     return SQ_ERROR;
2753   }
2754
2755   try {
2756     Scripting::wait(arg0, static_cast<float> (arg1));
2757
2758     return sq_suspendvm(vm);
2759
2760   } catch(std::exception& e) {
2761     sq_throwerror(vm, e.what());
2762     return SQ_ERROR;
2763   } catch(...) {
2764     sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait'"));
2765     return SQ_ERROR;
2766   }
2767
2768 }
2769
2770 static SQInteger wait_for_screenswitch_wrapper(HSQUIRRELVM vm)
2771 {
2772   HSQUIRRELVM arg0 = vm;
2773
2774   try {
2775     Scripting::wait_for_screenswitch(arg0);
2776
2777     return sq_suspendvm(vm);
2778
2779   } catch(std::exception& e) {
2780     sq_throwerror(vm, e.what());
2781     return SQ_ERROR;
2782   } catch(...) {
2783     sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_screenswitch'"));
2784     return SQ_ERROR;
2785   }
2786
2787 }
2788
2789 static SQInteger exit_screen_wrapper(HSQUIRRELVM vm)
2790 {
2791   (void) vm;
2792
2793   try {
2794     Scripting::exit_screen();
2795
2796     return 0;
2797
2798   } catch(std::exception& e) {
2799     sq_throwerror(vm, e.what());
2800     return SQ_ERROR;
2801   } catch(...) {
2802     sq_throwerror(vm, _SC("Unexpected exception while executing function 'exit_screen'"));
2803     return SQ_ERROR;
2804   }
2805
2806 }
2807
2808 static SQInteger fadeout_screen_wrapper(HSQUIRRELVM vm)
2809 {
2810   SQFloat arg0;
2811   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
2812     sq_throwerror(vm, _SC("Argument 1 not a float"));
2813     return SQ_ERROR;
2814   }
2815
2816   try {
2817     Scripting::fadeout_screen(static_cast<float> (arg0));
2818
2819     return 0;
2820
2821   } catch(std::exception& e) {
2822     sq_throwerror(vm, e.what());
2823     return SQ_ERROR;
2824   } catch(...) {
2825     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fadeout_screen'"));
2826     return SQ_ERROR;
2827   }
2828
2829 }
2830
2831 static SQInteger shrink_screen_wrapper(HSQUIRRELVM vm)
2832 {
2833   SQFloat arg0;
2834   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
2835     sq_throwerror(vm, _SC("Argument 1 not a float"));
2836     return SQ_ERROR;
2837   }
2838   SQFloat arg1;
2839   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
2840     sq_throwerror(vm, _SC("Argument 2 not a float"));
2841     return SQ_ERROR;
2842   }
2843   SQFloat arg2;
2844   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
2845     sq_throwerror(vm, _SC("Argument 3 not a float"));
2846     return SQ_ERROR;
2847   }
2848
2849   try {
2850     Scripting::shrink_screen(static_cast<float> (arg0), static_cast<float> (arg1), static_cast<float> (arg2));
2851
2852     return 0;
2853
2854   } catch(std::exception& e) {
2855     sq_throwerror(vm, e.what());
2856     return SQ_ERROR;
2857   } catch(...) {
2858     sq_throwerror(vm, _SC("Unexpected exception while executing function 'shrink_screen'"));
2859     return SQ_ERROR;
2860   }
2861
2862 }
2863
2864 static SQInteger abort_screenfade_wrapper(HSQUIRRELVM vm)
2865 {
2866   (void) vm;
2867
2868   try {
2869     Scripting::abort_screenfade();
2870
2871     return 0;
2872
2873   } catch(std::exception& e) {
2874     sq_throwerror(vm, e.what());
2875     return SQ_ERROR;
2876   } catch(...) {
2877     sq_throwerror(vm, _SC("Unexpected exception while executing function 'abort_screenfade'"));
2878     return SQ_ERROR;
2879   }
2880
2881 }
2882
2883 static SQInteger translate_wrapper(HSQUIRRELVM vm)
2884 {
2885   const SQChar* arg0;
2886   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
2887     sq_throwerror(vm, _SC("Argument 1 not a string"));
2888     return SQ_ERROR;
2889   }
2890
2891   try {
2892     std::string return_value = Scripting::translate(arg0);
2893
2894     sq_pushstring(vm, return_value.c_str(), return_value.size());
2895     return 1;
2896
2897   } catch(std::exception& e) {
2898     sq_throwerror(vm, e.what());
2899     return SQ_ERROR;
2900   } catch(...) {
2901     sq_throwerror(vm, _SC("Unexpected exception while executing function 'translate'"));
2902     return SQ_ERROR;
2903   }
2904
2905 }
2906
2907 static SQInteger import_wrapper(HSQUIRRELVM vm)
2908 {
2909   HSQUIRRELVM arg0 = vm;
2910   const SQChar* arg1;
2911   if(SQ_FAILED(sq_getstring(vm, 2, &arg1))) {
2912     sq_throwerror(vm, _SC("Argument 1 not a string"));
2913     return SQ_ERROR;
2914   }
2915
2916   try {
2917     Scripting::import(arg0, arg1);
2918
2919     return 0;
2920
2921   } catch(std::exception& e) {
2922     sq_throwerror(vm, e.what());
2923     return SQ_ERROR;
2924   } catch(...) {
2925     sq_throwerror(vm, _SC("Unexpected exception while executing function 'import'"));
2926     return SQ_ERROR;
2927   }
2928
2929 }
2930
2931 static SQInteger save_state_wrapper(HSQUIRRELVM vm)
2932 {
2933   (void) vm;
2934
2935   try {
2936     Scripting::save_state();
2937
2938     return 0;
2939
2940   } catch(std::exception& e) {
2941     sq_throwerror(vm, e.what());
2942     return SQ_ERROR;
2943   } catch(...) {
2944     sq_throwerror(vm, _SC("Unexpected exception while executing function 'save_state'"));
2945     return SQ_ERROR;
2946   }
2947
2948 }
2949
2950 static SQInteger update_worldmap_wrapper(HSQUIRRELVM vm)
2951 {
2952   (void) vm;
2953
2954   try {
2955     Scripting::update_worldmap();
2956
2957     return 0;
2958
2959   } catch(std::exception& e) {
2960     sq_throwerror(vm, e.what());
2961     return SQ_ERROR;
2962   } catch(...) {
2963     sq_throwerror(vm, _SC("Unexpected exception while executing function 'update_worldmap'"));
2964     return SQ_ERROR;
2965   }
2966
2967 }
2968
2969 static SQInteger debug_collrects_wrapper(HSQUIRRELVM vm)
2970 {
2971   SQBool arg0;
2972   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
2973     sq_throwerror(vm, _SC("Argument 1 not a bool"));
2974     return SQ_ERROR;
2975   }
2976
2977   try {
2978     Scripting::debug_collrects(arg0 == SQTrue);
2979
2980     return 0;
2981
2982   } catch(std::exception& e) {
2983     sq_throwerror(vm, e.what());
2984     return SQ_ERROR;
2985   } catch(...) {
2986     sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_collrects'"));
2987     return SQ_ERROR;
2988   }
2989
2990 }
2991
2992 static SQInteger debug_show_fps_wrapper(HSQUIRRELVM vm)
2993 {
2994   SQBool arg0;
2995   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
2996     sq_throwerror(vm, _SC("Argument 1 not a bool"));
2997     return SQ_ERROR;
2998   }
2999
3000   try {
3001     Scripting::debug_show_fps(arg0 == SQTrue);
3002
3003     return 0;
3004
3005   } catch(std::exception& e) {
3006     sq_throwerror(vm, e.what());
3007     return SQ_ERROR;
3008   } catch(...) {
3009     sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_show_fps'"));
3010     return SQ_ERROR;
3011   }
3012
3013 }
3014
3015 static SQInteger debug_draw_solids_only_wrapper(HSQUIRRELVM vm)
3016 {
3017   SQBool arg0;
3018   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
3019     sq_throwerror(vm, _SC("Argument 1 not a bool"));
3020     return SQ_ERROR;
3021   }
3022
3023   try {
3024     Scripting::debug_draw_solids_only(arg0 == SQTrue);
3025
3026     return 0;
3027
3028   } catch(std::exception& e) {
3029     sq_throwerror(vm, e.what());
3030     return SQ_ERROR;
3031   } catch(...) {
3032     sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_draw_solids_only'"));
3033     return SQ_ERROR;
3034   }
3035
3036 }
3037
3038 static SQInteger play_music_wrapper(HSQUIRRELVM vm)
3039 {
3040   const SQChar* arg0;
3041   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
3042     sq_throwerror(vm, _SC("Argument 1 not a string"));
3043     return SQ_ERROR;
3044   }
3045
3046   try {
3047     Scripting::play_music(arg0);
3048
3049     return 0;
3050
3051   } catch(std::exception& e) {
3052     sq_throwerror(vm, e.what());
3053     return SQ_ERROR;
3054   } catch(...) {
3055     sq_throwerror(vm, _SC("Unexpected exception while executing function 'play_music'"));
3056     return SQ_ERROR;
3057   }
3058
3059 }
3060
3061 static SQInteger play_sound_wrapper(HSQUIRRELVM vm)
3062 {
3063   const SQChar* arg0;
3064   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
3065     sq_throwerror(vm, _SC("Argument 1 not a string"));
3066     return SQ_ERROR;
3067   }
3068
3069   try {
3070     Scripting::play_sound(arg0);
3071
3072     return 0;
3073
3074   } catch(std::exception& e) {
3075     sq_throwerror(vm, e.what());
3076     return SQ_ERROR;
3077   } catch(...) {
3078     sq_throwerror(vm, _SC("Unexpected exception while executing function 'play_sound'"));
3079     return SQ_ERROR;
3080   }
3081
3082 }
3083
3084 static SQInteger grease_wrapper(HSQUIRRELVM vm)
3085 {
3086   (void) vm;
3087
3088   try {
3089     Scripting::grease();
3090
3091     return 0;
3092
3093   } catch(std::exception& e) {
3094     sq_throwerror(vm, e.what());
3095     return SQ_ERROR;
3096   } catch(...) {
3097     sq_throwerror(vm, _SC("Unexpected exception while executing function 'grease'"));
3098     return SQ_ERROR;
3099   }
3100
3101 }
3102
3103 static SQInteger invincible_wrapper(HSQUIRRELVM vm)
3104 {
3105   (void) vm;
3106
3107   try {
3108     Scripting::invincible();
3109
3110     return 0;
3111
3112   } catch(std::exception& e) {
3113     sq_throwerror(vm, e.what());
3114     return SQ_ERROR;
3115   } catch(...) {
3116     sq_throwerror(vm, _SC("Unexpected exception while executing function 'invincible'"));
3117     return SQ_ERROR;
3118   }
3119
3120 }
3121
3122 static SQInteger ghost_wrapper(HSQUIRRELVM vm)
3123 {
3124   (void) vm;
3125
3126   try {
3127     Scripting::ghost();
3128
3129     return 0;
3130
3131   } catch(std::exception& e) {
3132     sq_throwerror(vm, e.what());
3133     return SQ_ERROR;
3134   } catch(...) {
3135     sq_throwerror(vm, _SC("Unexpected exception while executing function 'ghost'"));
3136     return SQ_ERROR;
3137   }
3138
3139 }
3140
3141 static SQInteger mortal_wrapper(HSQUIRRELVM vm)
3142 {
3143   (void) vm;
3144
3145   try {
3146     Scripting::mortal();
3147
3148     return 0;
3149
3150   } catch(std::exception& e) {
3151     sq_throwerror(vm, e.what());
3152     return SQ_ERROR;
3153   } catch(...) {
3154     sq_throwerror(vm, _SC("Unexpected exception while executing function 'mortal'"));
3155     return SQ_ERROR;
3156   }
3157
3158 }
3159
3160 static SQInteger restart_wrapper(HSQUIRRELVM vm)
3161 {
3162   (void) vm;
3163
3164   try {
3165     Scripting::restart();
3166
3167     return 0;
3168
3169   } catch(std::exception& e) {
3170     sq_throwerror(vm, e.what());
3171     return SQ_ERROR;
3172   } catch(...) {
3173     sq_throwerror(vm, _SC("Unexpected exception while executing function 'restart'"));
3174     return SQ_ERROR;
3175   }
3176
3177 }
3178
3179 static SQInteger whereami_wrapper(HSQUIRRELVM vm)
3180 {
3181   (void) vm;
3182
3183   try {
3184     Scripting::whereami();
3185
3186     return 0;
3187
3188   } catch(std::exception& e) {
3189     sq_throwerror(vm, e.what());
3190     return SQ_ERROR;
3191   } catch(...) {
3192     sq_throwerror(vm, _SC("Unexpected exception while executing function 'whereami'"));
3193     return SQ_ERROR;
3194   }
3195
3196 }
3197
3198 static SQInteger gotoend_wrapper(HSQUIRRELVM vm)
3199 {
3200   (void) vm;
3201
3202   try {
3203     Scripting::gotoend();
3204
3205     return 0;
3206
3207   } catch(std::exception& e) {
3208     sq_throwerror(vm, e.what());
3209     return SQ_ERROR;
3210   } catch(...) {
3211     sq_throwerror(vm, _SC("Unexpected exception while executing function 'gotoend'"));
3212     return SQ_ERROR;
3213   }
3214
3215 }
3216
3217 static SQInteger camera_wrapper(HSQUIRRELVM vm)
3218 {
3219   (void) vm;
3220
3221   try {
3222     Scripting::camera();
3223
3224     return 0;
3225
3226   } catch(std::exception& e) {
3227     sq_throwerror(vm, e.what());
3228     return SQ_ERROR;
3229   } catch(...) {
3230     sq_throwerror(vm, _SC("Unexpected exception while executing function 'camera'"));
3231     return SQ_ERROR;
3232   }
3233
3234 }
3235
3236 static SQInteger quit_wrapper(HSQUIRRELVM vm)
3237 {
3238   (void) vm;
3239
3240   try {
3241     Scripting::quit();
3242
3243     return 0;
3244
3245   } catch(std::exception& e) {
3246     sq_throwerror(vm, e.what());
3247     return SQ_ERROR;
3248   } catch(...) {
3249     sq_throwerror(vm, _SC("Unexpected exception while executing function 'quit'"));
3250     return SQ_ERROR;
3251   }
3252
3253 }
3254
3255 static SQInteger rand_wrapper(HSQUIRRELVM vm)
3256 {
3257
3258   try {
3259     int return_value = Scripting::rand();
3260
3261     sq_pushinteger(vm, return_value);
3262     return 1;
3263
3264   } catch(std::exception& e) {
3265     sq_throwerror(vm, e.what());
3266     return SQ_ERROR;
3267   } catch(...) {
3268     sq_throwerror(vm, _SC("Unexpected exception while executing function 'rand'"));
3269     return SQ_ERROR;
3270   }
3271
3272 }
3273
3274 } // end of namespace Wrapper
3275 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
3276 {
3277   using namespace Wrapper;
3278
3279   sq_pushroottable(v);
3280   sq_pushstring(v, "DisplayEffect", -1);
3281   if(SQ_FAILED(sq_get(v, -2))) {
3282     std::ostringstream msg;
3283     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
3284     throw SquirrelError(v, msg.str());
3285   }
3286
3287   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3288     std::ostringstream msg;
3289     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
3290     throw SquirrelError(v, msg.str());
3291   }
3292   sq_remove(v, -2); // remove object name
3293
3294   if(setup_releasehook) {
3295     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
3296   }
3297
3298   sq_remove(v, -2); // remove root table
3299 }
3300
3301 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
3302 {
3303   using namespace Wrapper;
3304
3305   sq_pushroottable(v);
3306   sq_pushstring(v, "Camera", -1);
3307   if(SQ_FAILED(sq_get(v, -2))) {
3308     std::ostringstream msg;
3309     msg << "Couldn't resolved squirrel type 'Camera'";
3310     throw SquirrelError(v, msg.str());
3311   }
3312
3313   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3314     std::ostringstream msg;
3315     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
3316     throw SquirrelError(v, msg.str());
3317   }
3318   sq_remove(v, -2); // remove object name
3319
3320   if(setup_releasehook) {
3321     sq_setreleasehook(v, -1, Camera_release_hook);
3322   }
3323
3324   sq_remove(v, -2); // remove root table
3325 }
3326
3327 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
3328 {
3329   using namespace Wrapper;
3330
3331   sq_pushroottable(v);
3332   sq_pushstring(v, "Level", -1);
3333   if(SQ_FAILED(sq_get(v, -2))) {
3334     std::ostringstream msg;
3335     msg << "Couldn't resolved squirrel type 'Level'";
3336     throw SquirrelError(v, msg.str());
3337   }
3338
3339   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3340     std::ostringstream msg;
3341     msg << "Couldn't setup squirrel instance for object of type 'Level'";
3342     throw SquirrelError(v, msg.str());
3343   }
3344   sq_remove(v, -2); // remove object name
3345
3346   if(setup_releasehook) {
3347     sq_setreleasehook(v, -1, Level_release_hook);
3348   }
3349
3350   sq_remove(v, -2); // remove root table
3351 }
3352
3353 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
3354 {
3355   using namespace Wrapper;
3356
3357   sq_pushroottable(v);
3358   sq_pushstring(v, "ScriptedObject", -1);
3359   if(SQ_FAILED(sq_get(v, -2))) {
3360     std::ostringstream msg;
3361     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
3362     throw SquirrelError(v, msg.str());
3363   }
3364
3365   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3366     std::ostringstream msg;
3367     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
3368     throw SquirrelError(v, msg.str());
3369   }
3370   sq_remove(v, -2); // remove object name
3371
3372   if(setup_releasehook) {
3373     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
3374   }
3375
3376   sq_remove(v, -2); // remove root table
3377 }
3378
3379 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
3380 {
3381   using namespace Wrapper;
3382
3383   sq_pushroottable(v);
3384   sq_pushstring(v, "Text", -1);
3385   if(SQ_FAILED(sq_get(v, -2))) {
3386     std::ostringstream msg;
3387     msg << "Couldn't resolved squirrel type 'Text'";
3388     throw SquirrelError(v, msg.str());
3389   }
3390
3391   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3392     std::ostringstream msg;
3393     msg << "Couldn't setup squirrel instance for object of type 'Text'";
3394     throw SquirrelError(v, msg.str());
3395   }
3396   sq_remove(v, -2); // remove object name
3397
3398   if(setup_releasehook) {
3399     sq_setreleasehook(v, -1, Text_release_hook);
3400   }
3401
3402   sq_remove(v, -2); // remove root table
3403 }
3404
3405 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
3406 {
3407   using namespace Wrapper;
3408
3409   sq_pushroottable(v);
3410   sq_pushstring(v, "Player", -1);
3411   if(SQ_FAILED(sq_get(v, -2))) {
3412     std::ostringstream msg;
3413     msg << "Couldn't resolved squirrel type 'Player'";
3414     throw SquirrelError(v, msg.str());
3415   }
3416
3417   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3418     std::ostringstream msg;
3419     msg << "Couldn't setup squirrel instance for object of type 'Player'";
3420     throw SquirrelError(v, msg.str());
3421   }
3422   sq_remove(v, -2); // remove object name
3423
3424   if(setup_releasehook) {
3425     sq_setreleasehook(v, -1, Player_release_hook);
3426   }
3427
3428   sq_remove(v, -2); // remove root table
3429 }
3430
3431 void create_squirrel_instance(HSQUIRRELVM v, Scripting::FloatingImage* object, bool setup_releasehook)
3432 {
3433   using namespace Wrapper;
3434
3435   sq_pushroottable(v);
3436   sq_pushstring(v, "FloatingImage", -1);
3437   if(SQ_FAILED(sq_get(v, -2))) {
3438     std::ostringstream msg;
3439     msg << "Couldn't resolved squirrel type 'FloatingImage'";
3440     throw SquirrelError(v, msg.str());
3441   }
3442
3443   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3444     std::ostringstream msg;
3445     msg << "Couldn't setup squirrel instance for object of type 'FloatingImage'";
3446     throw SquirrelError(v, msg.str());
3447   }
3448   sq_remove(v, -2); // remove object name
3449
3450   if(setup_releasehook) {
3451     sq_setreleasehook(v, -1, FloatingImage_release_hook);
3452   }
3453
3454   sq_remove(v, -2); // remove root table
3455 }
3456
3457 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Platform* object, bool setup_releasehook)
3458 {
3459   using namespace Wrapper;
3460
3461   sq_pushroottable(v);
3462   sq_pushstring(v, "Platform", -1);
3463   if(SQ_FAILED(sq_get(v, -2))) {
3464     std::ostringstream msg;
3465     msg << "Couldn't resolved squirrel type 'Platform'";
3466     throw SquirrelError(v, msg.str());
3467   }
3468
3469   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3470     std::ostringstream msg;
3471     msg << "Couldn't setup squirrel instance for object of type 'Platform'";
3472     throw SquirrelError(v, msg.str());
3473   }
3474   sq_remove(v, -2); // remove object name
3475
3476   if(setup_releasehook) {
3477     sq_setreleasehook(v, -1, Platform_release_hook);
3478   }
3479
3480   sq_remove(v, -2); // remove root table
3481 }
3482
3483 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Candle* object, bool setup_releasehook)
3484 {
3485   using namespace Wrapper;
3486
3487   sq_pushroottable(v);
3488   sq_pushstring(v, "Candle", -1);
3489   if(SQ_FAILED(sq_get(v, -2))) {
3490     std::ostringstream msg;
3491     msg << "Couldn't resolved squirrel type 'Candle'";
3492     throw SquirrelError(v, msg.str());
3493   }
3494
3495   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3496     std::ostringstream msg;
3497     msg << "Couldn't setup squirrel instance for object of type 'Candle'";
3498     throw SquirrelError(v, msg.str());
3499   }
3500   sq_remove(v, -2); // remove object name
3501
3502   if(setup_releasehook) {
3503     sq_setreleasehook(v, -1, Candle_release_hook);
3504   }
3505
3506   sq_remove(v, -2); // remove root table
3507 }
3508
3509 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Wind* object, bool setup_releasehook)
3510 {
3511   using namespace Wrapper;
3512
3513   sq_pushroottable(v);
3514   sq_pushstring(v, "Wind", -1);
3515   if(SQ_FAILED(sq_get(v, -2))) {
3516     std::ostringstream msg;
3517     msg << "Couldn't resolved squirrel type 'Wind'";
3518     throw SquirrelError(v, msg.str());
3519   }
3520
3521   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3522     std::ostringstream msg;
3523     msg << "Couldn't setup squirrel instance for object of type 'Wind'";
3524     throw SquirrelError(v, msg.str());
3525   }
3526   sq_remove(v, -2); // remove object name
3527
3528   if(setup_releasehook) {
3529     sq_setreleasehook(v, -1, Wind_release_hook);
3530   }
3531
3532   sq_remove(v, -2); // remove root table
3533 }
3534
3535 void create_squirrel_instance(HSQUIRRELVM v, Scripting::AmbientSound* object, bool setup_releasehook)
3536 {
3537   using namespace Wrapper;
3538
3539   sq_pushroottable(v);
3540   sq_pushstring(v, "AmbientSound", -1);
3541   if(SQ_FAILED(sq_get(v, -2))) {
3542     std::ostringstream msg;
3543     msg << "Couldn't resolved squirrel type 'AmbientSound'";
3544     throw SquirrelError(v, msg.str());
3545   }
3546
3547   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3548     std::ostringstream msg;
3549     msg << "Couldn't setup squirrel instance for object of type 'AmbientSound'";
3550     throw SquirrelError(v, msg.str());
3551   }
3552   sq_remove(v, -2); // remove object name
3553
3554   if(setup_releasehook) {
3555     sq_setreleasehook(v, -1, AmbientSound_release_hook);
3556   }
3557
3558   sq_remove(v, -2); // remove root table
3559 }
3560
3561 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Thunderstorm* object, bool setup_releasehook)
3562 {
3563   using namespace Wrapper;
3564
3565   sq_pushroottable(v);
3566   sq_pushstring(v, "Thunderstorm", -1);
3567   if(SQ_FAILED(sq_get(v, -2))) {
3568     std::ostringstream msg;
3569     msg << "Couldn't resolved squirrel type 'Thunderstorm'";
3570     throw SquirrelError(v, msg.str());
3571   }
3572
3573   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3574     std::ostringstream msg;
3575     msg << "Couldn't setup squirrel instance for object of type 'Thunderstorm'";
3576     throw SquirrelError(v, msg.str());
3577   }
3578   sq_remove(v, -2); // remove object name
3579
3580   if(setup_releasehook) {
3581     sq_setreleasehook(v, -1, Thunderstorm_release_hook);
3582   }
3583
3584   sq_remove(v, -2); // remove root table
3585 }
3586
3587 void create_squirrel_instance(HSQUIRRELVM v, Scripting::TileMap* object, bool setup_releasehook)
3588 {
3589   using namespace Wrapper;
3590
3591   sq_pushroottable(v);
3592   sq_pushstring(v, "TileMap", -1);
3593   if(SQ_FAILED(sq_get(v, -2))) {
3594     std::ostringstream msg;
3595     msg << "Couldn't resolved squirrel type 'TileMap'";
3596     throw SquirrelError(v, msg.str());
3597   }
3598
3599   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3600     std::ostringstream msg;
3601     msg << "Couldn't setup squirrel instance for object of type 'TileMap'";
3602     throw SquirrelError(v, msg.str());
3603   }
3604   sq_remove(v, -2); // remove object name
3605
3606   if(setup_releasehook) {
3607     sq_setreleasehook(v, -1, TileMap_release_hook);
3608   }
3609
3610   sq_remove(v, -2); // remove root table
3611 }
3612
3613 void create_squirrel_instance(HSQUIRRELVM v, Scripting::SSector* object, bool setup_releasehook)
3614 {
3615   using namespace Wrapper;
3616
3617   sq_pushroottable(v);
3618   sq_pushstring(v, "SSector", -1);
3619   if(SQ_FAILED(sq_get(v, -2))) {
3620     std::ostringstream msg;
3621     msg << "Couldn't resolved squirrel type 'SSector'";
3622     throw SquirrelError(v, msg.str());
3623   }
3624
3625   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3626     std::ostringstream msg;
3627     msg << "Couldn't setup squirrel instance for object of type 'SSector'";
3628     throw SquirrelError(v, msg.str());
3629   }
3630   sq_remove(v, -2); // remove object name
3631
3632   if(setup_releasehook) {
3633     sq_setreleasehook(v, -1, SSector_release_hook);
3634   }
3635
3636   sq_remove(v, -2); // remove root table
3637 }
3638
3639 void create_squirrel_instance(HSQUIRRELVM v, Scripting::LevelTime* object, bool setup_releasehook)
3640 {
3641   using namespace Wrapper;
3642
3643   sq_pushroottable(v);
3644   sq_pushstring(v, "LevelTime", -1);
3645   if(SQ_FAILED(sq_get(v, -2))) {
3646     std::ostringstream msg;
3647     msg << "Couldn't resolved squirrel type 'LevelTime'";
3648     throw SquirrelError(v, msg.str());
3649   }
3650
3651   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
3652     std::ostringstream msg;
3653     msg << "Couldn't setup squirrel instance for object of type 'LevelTime'";
3654     throw SquirrelError(v, msg.str());
3655   }
3656   sq_remove(v, -2); // remove object name
3657
3658   if(setup_releasehook) {
3659     sq_setreleasehook(v, -1, LevelTime_release_hook);
3660   }
3661
3662   sq_remove(v, -2); // remove root table
3663 }
3664
3665 void register_supertux_wrapper(HSQUIRRELVM v)
3666 {
3667   using namespace Wrapper;
3668
3669   sq_pushstring(v, "ANCHOR_TOP", -1);
3670   sq_pushinteger(v, 16);
3671   if(SQ_FAILED(sq_createslot(v, -3))) {
3672     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP'");
3673   }
3674
3675   sq_pushstring(v, "ANCHOR_BOTTOM", -1);
3676   sq_pushinteger(v, 32);
3677   if(SQ_FAILED(sq_createslot(v, -3))) {
3678     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM'");
3679   }
3680
3681   sq_pushstring(v, "ANCHOR_LEFT", -1);
3682   sq_pushinteger(v, 1);
3683   if(SQ_FAILED(sq_createslot(v, -3))) {
3684     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_LEFT'");
3685   }
3686
3687   sq_pushstring(v, "ANCHOR_RIGHT", -1);
3688   sq_pushinteger(v, 2);
3689   if(SQ_FAILED(sq_createslot(v, -3))) {
3690     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_RIGHT'");
3691   }
3692
3693   sq_pushstring(v, "ANCHOR_MIDDLE", -1);
3694   sq_pushinteger(v, 0);
3695   if(SQ_FAILED(sq_createslot(v, -3))) {
3696     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_MIDDLE'");
3697   }
3698
3699   sq_pushstring(v, "ANCHOR_TOP_LEFT", -1);
3700   sq_pushinteger(v, 17);
3701   if(SQ_FAILED(sq_createslot(v, -3))) {
3702     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_LEFT'");
3703   }
3704
3705   sq_pushstring(v, "ANCHOR_TOP_RIGHT", -1);
3706   sq_pushinteger(v, 18);
3707   if(SQ_FAILED(sq_createslot(v, -3))) {
3708     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_RIGHT'");
3709   }
3710
3711   sq_pushstring(v, "ANCHOR_BOTTOM_LEFT", -1);
3712   sq_pushinteger(v, 33);
3713   if(SQ_FAILED(sq_createslot(v, -3))) {
3714     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_LEFT'");
3715   }
3716
3717   sq_pushstring(v, "ANCHOR_BOTTOM_RIGHT", -1);
3718   sq_pushinteger(v, 34);
3719   if(SQ_FAILED(sq_createslot(v, -3))) {
3720     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_RIGHT'");
3721   }
3722
3723   sq_pushstring(v, "display", -1);
3724   sq_newclosure(v, &display_wrapper, 0);
3725   if(SQ_FAILED(sq_createslot(v, -3))) {
3726     throw SquirrelError(v, "Couldn't register function 'display'");
3727   }
3728
3729   sq_pushstring(v, "print_stacktrace", -1);
3730   sq_newclosure(v, &print_stacktrace_wrapper, 0);
3731   if(SQ_FAILED(sq_createslot(v, -3))) {
3732     throw SquirrelError(v, "Couldn't register function 'print_stacktrace'");
3733   }
3734
3735   sq_pushstring(v, "get_current_thread", -1);
3736   sq_newclosure(v, &get_current_thread_wrapper, 0);
3737   if(SQ_FAILED(sq_createslot(v, -3))) {
3738     throw SquirrelError(v, "Couldn't register function 'get_current_thread'");
3739   }
3740
3741   sq_pushstring(v, "display_text_file", -1);
3742   sq_newclosure(v, &display_text_file_wrapper, 0);
3743   if(SQ_FAILED(sq_createslot(v, -3))) {
3744     throw SquirrelError(v, "Couldn't register function 'display_text_file'");
3745   }
3746
3747   sq_pushstring(v, "load_worldmap", -1);
3748   sq_newclosure(v, &load_worldmap_wrapper, 0);
3749   if(SQ_FAILED(sq_createslot(v, -3))) {
3750     throw SquirrelError(v, "Couldn't register function 'load_worldmap'");
3751   }
3752
3753   sq_pushstring(v, "load_level", -1);
3754   sq_newclosure(v, &load_level_wrapper, 0);
3755   if(SQ_FAILED(sq_createslot(v, -3))) {
3756     throw SquirrelError(v, "Couldn't register function 'load_level'");
3757   }
3758
3759   sq_pushstring(v, "wait", -1);
3760   sq_newclosure(v, &wait_wrapper, 0);
3761   if(SQ_FAILED(sq_createslot(v, -3))) {
3762     throw SquirrelError(v, "Couldn't register function 'wait'");
3763   }
3764
3765   sq_pushstring(v, "wait_for_screenswitch", -1);
3766   sq_newclosure(v, &wait_for_screenswitch_wrapper, 0);
3767   if(SQ_FAILED(sq_createslot(v, -3))) {
3768     throw SquirrelError(v, "Couldn't register function 'wait_for_screenswitch'");
3769   }
3770
3771   sq_pushstring(v, "exit_screen", -1);
3772   sq_newclosure(v, &exit_screen_wrapper, 0);
3773   if(SQ_FAILED(sq_createslot(v, -3))) {
3774     throw SquirrelError(v, "Couldn't register function 'exit_screen'");
3775   }
3776
3777   sq_pushstring(v, "fadeout_screen", -1);
3778   sq_newclosure(v, &fadeout_screen_wrapper, 0);
3779   if(SQ_FAILED(sq_createslot(v, -3))) {
3780     throw SquirrelError(v, "Couldn't register function 'fadeout_screen'");
3781   }
3782
3783   sq_pushstring(v, "shrink_screen", -1);
3784   sq_newclosure(v, &shrink_screen_wrapper, 0);
3785   if(SQ_FAILED(sq_createslot(v, -3))) {
3786     throw SquirrelError(v, "Couldn't register function 'shrink_screen'");
3787   }
3788
3789   sq_pushstring(v, "abort_screenfade", -1);
3790   sq_newclosure(v, &abort_screenfade_wrapper, 0);
3791   if(SQ_FAILED(sq_createslot(v, -3))) {
3792     throw SquirrelError(v, "Couldn't register function 'abort_screenfade'");
3793   }
3794
3795   sq_pushstring(v, "translate", -1);
3796   sq_newclosure(v, &translate_wrapper, 0);
3797   if(SQ_FAILED(sq_createslot(v, -3))) {
3798     throw SquirrelError(v, "Couldn't register function 'translate'");
3799   }
3800
3801   sq_pushstring(v, "import", -1);
3802   sq_newclosure(v, &import_wrapper, 0);
3803   if(SQ_FAILED(sq_createslot(v, -3))) {
3804     throw SquirrelError(v, "Couldn't register function 'import'");
3805   }
3806
3807   sq_pushstring(v, "save_state", -1);
3808   sq_newclosure(v, &save_state_wrapper, 0);
3809   if(SQ_FAILED(sq_createslot(v, -3))) {
3810     throw SquirrelError(v, "Couldn't register function 'save_state'");
3811   }
3812
3813   sq_pushstring(v, "update_worldmap", -1);
3814   sq_newclosure(v, &update_worldmap_wrapper, 0);
3815   if(SQ_FAILED(sq_createslot(v, -3))) {
3816     throw SquirrelError(v, "Couldn't register function 'update_worldmap'");
3817   }
3818
3819   sq_pushstring(v, "debug_collrects", -1);
3820   sq_newclosure(v, &debug_collrects_wrapper, 0);
3821   if(SQ_FAILED(sq_createslot(v, -3))) {
3822     throw SquirrelError(v, "Couldn't register function 'debug_collrects'");
3823   }
3824
3825   sq_pushstring(v, "debug_show_fps", -1);
3826   sq_newclosure(v, &debug_show_fps_wrapper, 0);
3827   if(SQ_FAILED(sq_createslot(v, -3))) {
3828     throw SquirrelError(v, "Couldn't register function 'debug_show_fps'");
3829   }
3830
3831   sq_pushstring(v, "debug_draw_solids_only", -1);
3832   sq_newclosure(v, &debug_draw_solids_only_wrapper, 0);
3833   if(SQ_FAILED(sq_createslot(v, -3))) {
3834     throw SquirrelError(v, "Couldn't register function 'debug_draw_solids_only'");
3835   }
3836
3837   sq_pushstring(v, "play_music", -1);
3838   sq_newclosure(v, &play_music_wrapper, 0);
3839   if(SQ_FAILED(sq_createslot(v, -3))) {
3840     throw SquirrelError(v, "Couldn't register function 'play_music'");
3841   }
3842
3843   sq_pushstring(v, "play_sound", -1);
3844   sq_newclosure(v, &play_sound_wrapper, 0);
3845   if(SQ_FAILED(sq_createslot(v, -3))) {
3846     throw SquirrelError(v, "Couldn't register function 'play_sound'");
3847   }
3848
3849   sq_pushstring(v, "grease", -1);
3850   sq_newclosure(v, &grease_wrapper, 0);
3851   if(SQ_FAILED(sq_createslot(v, -3))) {
3852     throw SquirrelError(v, "Couldn't register function 'grease'");
3853   }
3854
3855   sq_pushstring(v, "invincible", -1);
3856   sq_newclosure(v, &invincible_wrapper, 0);
3857   if(SQ_FAILED(sq_createslot(v, -3))) {
3858     throw SquirrelError(v, "Couldn't register function 'invincible'");
3859   }
3860
3861   sq_pushstring(v, "ghost", -1);
3862   sq_newclosure(v, &ghost_wrapper, 0);
3863   if(SQ_FAILED(sq_createslot(v, -3))) {
3864     throw SquirrelError(v, "Couldn't register function 'ghost'");
3865   }
3866
3867   sq_pushstring(v, "mortal", -1);
3868   sq_newclosure(v, &mortal_wrapper, 0);
3869   if(SQ_FAILED(sq_createslot(v, -3))) {
3870     throw SquirrelError(v, "Couldn't register function 'mortal'");
3871   }
3872
3873   sq_pushstring(v, "restart", -1);
3874   sq_newclosure(v, &restart_wrapper, 0);
3875   if(SQ_FAILED(sq_createslot(v, -3))) {
3876     throw SquirrelError(v, "Couldn't register function 'restart'");
3877   }
3878
3879   sq_pushstring(v, "whereami", -1);
3880   sq_newclosure(v, &whereami_wrapper, 0);
3881   if(SQ_FAILED(sq_createslot(v, -3))) {
3882     throw SquirrelError(v, "Couldn't register function 'whereami'");
3883   }
3884
3885   sq_pushstring(v, "gotoend", -1);
3886   sq_newclosure(v, &gotoend_wrapper, 0);
3887   if(SQ_FAILED(sq_createslot(v, -3))) {
3888     throw SquirrelError(v, "Couldn't register function 'gotoend'");
3889   }
3890
3891   sq_pushstring(v, "camera", -1);
3892   sq_newclosure(v, &camera_wrapper, 0);
3893   if(SQ_FAILED(sq_createslot(v, -3))) {
3894     throw SquirrelError(v, "Couldn't register function 'camera'");
3895   }
3896
3897   sq_pushstring(v, "quit", -1);
3898   sq_newclosure(v, &quit_wrapper, 0);
3899   if(SQ_FAILED(sq_createslot(v, -3))) {
3900     throw SquirrelError(v, "Couldn't register function 'quit'");
3901   }
3902
3903   sq_pushstring(v, "rand", -1);
3904   sq_newclosure(v, &rand_wrapper, 0);
3905   if(SQ_FAILED(sq_createslot(v, -3))) {
3906     throw SquirrelError(v, "Couldn't register function 'rand'");
3907   }
3908
3909   // Register class DisplayEffect
3910   sq_pushstring(v, "DisplayEffect", -1);
3911   if(sq_newclass(v, SQFalse) < 0) {
3912     std::ostringstream msg;
3913     msg << "Couldn't create new class 'DisplayEffect'";
3914     throw SquirrelError(v, msg.str());
3915   }
3916   sq_pushstring(v, "fade_out", -1);
3917   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
3918   if(SQ_FAILED(sq_createslot(v, -3))) {
3919     throw SquirrelError(v, "Couldn't register function 'fade_out'");
3920   }
3921
3922   sq_pushstring(v, "fade_in", -1);
3923   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
3924   if(SQ_FAILED(sq_createslot(v, -3))) {
3925     throw SquirrelError(v, "Couldn't register function 'fade_in'");
3926   }
3927
3928   sq_pushstring(v, "set_black", -1);
3929   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
3930   if(SQ_FAILED(sq_createslot(v, -3))) {
3931     throw SquirrelError(v, "Couldn't register function 'set_black'");
3932   }
3933
3934   sq_pushstring(v, "is_black", -1);
3935   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
3936   if(SQ_FAILED(sq_createslot(v, -3))) {
3937     throw SquirrelError(v, "Couldn't register function 'is_black'");
3938   }
3939
3940   sq_pushstring(v, "sixteen_to_nine", -1);
3941   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
3942   if(SQ_FAILED(sq_createslot(v, -3))) {
3943     throw SquirrelError(v, "Couldn't register function 'sixteen_to_nine'");
3944   }
3945
3946   sq_pushstring(v, "four_to_three", -1);
3947   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
3948   if(SQ_FAILED(sq_createslot(v, -3))) {
3949     throw SquirrelError(v, "Couldn't register function 'four_to_three'");
3950   }
3951
3952   if(SQ_FAILED(sq_createslot(v, -3))) {
3953     throw SquirrelError(v, "Couldn't register class 'DisplayEffect'");
3954   }
3955
3956   // Register class Camera
3957   sq_pushstring(v, "Camera", -1);
3958   if(sq_newclass(v, SQFalse) < 0) {
3959     std::ostringstream msg;
3960     msg << "Couldn't create new class 'Camera'";
3961     throw SquirrelError(v, msg.str());
3962   }
3963   sq_pushstring(v, "shake", -1);
3964   sq_newclosure(v, &Camera_shake_wrapper, 0);
3965   if(SQ_FAILED(sq_createslot(v, -3))) {
3966     throw SquirrelError(v, "Couldn't register function 'shake'");
3967   }
3968
3969   sq_pushstring(v, "set_pos", -1);
3970   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
3971   if(SQ_FAILED(sq_createslot(v, -3))) {
3972     throw SquirrelError(v, "Couldn't register function 'set_pos'");
3973   }
3974
3975   sq_pushstring(v, "set_mode", -1);
3976   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
3977   if(SQ_FAILED(sq_createslot(v, -3))) {
3978     throw SquirrelError(v, "Couldn't register function 'set_mode'");
3979   }
3980
3981   sq_pushstring(v, "scroll_to", -1);
3982   sq_newclosure(v, &Camera_scroll_to_wrapper, 0);
3983   if(SQ_FAILED(sq_createslot(v, -3))) {
3984     throw SquirrelError(v, "Couldn't register function 'scroll_to'");
3985   }
3986
3987   if(SQ_FAILED(sq_createslot(v, -3))) {
3988     throw SquirrelError(v, "Couldn't register class 'Camera'");
3989   }
3990
3991   // Register class Level
3992   sq_pushstring(v, "Level", -1);
3993   if(sq_newclass(v, SQFalse) < 0) {
3994     std::ostringstream msg;
3995     msg << "Couldn't create new class 'Level'";
3996     throw SquirrelError(v, msg.str());
3997   }
3998   sq_pushstring(v, "finish", -1);
3999   sq_newclosure(v, &Level_finish_wrapper, 0);
4000   if(SQ_FAILED(sq_createslot(v, -3))) {
4001     throw SquirrelError(v, "Couldn't register function 'finish'");
4002   }
4003
4004   sq_pushstring(v, "spawn", -1);
4005   sq_newclosure(v, &Level_spawn_wrapper, 0);
4006   if(SQ_FAILED(sq_createslot(v, -3))) {
4007     throw SquirrelError(v, "Couldn't register function 'spawn'");
4008   }
4009
4010   sq_pushstring(v, "flip_vertically", -1);
4011   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
4012   if(SQ_FAILED(sq_createslot(v, -3))) {
4013     throw SquirrelError(v, "Couldn't register function 'flip_vertically'");
4014   }
4015
4016   sq_pushstring(v, "toggle_pause", -1);
4017   sq_newclosure(v, &Level_toggle_pause_wrapper, 0);
4018   if(SQ_FAILED(sq_createslot(v, -3))) {
4019     throw SquirrelError(v, "Couldn't register function 'toggle_pause'");
4020   }
4021
4022   if(SQ_FAILED(sq_createslot(v, -3))) {
4023     throw SquirrelError(v, "Couldn't register class 'Level'");
4024   }
4025
4026   // Register class ScriptedObject
4027   sq_pushstring(v, "ScriptedObject", -1);
4028   if(sq_newclass(v, SQFalse) < 0) {
4029     std::ostringstream msg;
4030     msg << "Couldn't create new class 'ScriptedObject'";
4031     throw SquirrelError(v, msg.str());
4032   }
4033   sq_pushstring(v, "set_action", -1);
4034   sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0);
4035   if(SQ_FAILED(sq_createslot(v, -3))) {
4036     throw SquirrelError(v, "Couldn't register function 'set_action'");
4037   }
4038
4039   sq_pushstring(v, "get_action", -1);
4040   sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0);
4041   if(SQ_FAILED(sq_createslot(v, -3))) {
4042     throw SquirrelError(v, "Couldn't register function 'get_action'");
4043   }
4044
4045   sq_pushstring(v, "move", -1);
4046   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
4047   if(SQ_FAILED(sq_createslot(v, -3))) {
4048     throw SquirrelError(v, "Couldn't register function 'move'");
4049   }
4050
4051   sq_pushstring(v, "set_pos", -1);
4052   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
4053   if(SQ_FAILED(sq_createslot(v, -3))) {
4054     throw SquirrelError(v, "Couldn't register function 'set_pos'");
4055   }
4056
4057   sq_pushstring(v, "get_pos_x", -1);
4058   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
4059   if(SQ_FAILED(sq_createslot(v, -3))) {
4060     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
4061   }
4062
4063   sq_pushstring(v, "get_pos_y", -1);
4064   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
4065   if(SQ_FAILED(sq_createslot(v, -3))) {
4066     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
4067   }
4068
4069   sq_pushstring(v, "set_velocity", -1);
4070   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
4071   if(SQ_FAILED(sq_createslot(v, -3))) {
4072     throw SquirrelError(v, "Couldn't register function 'set_velocity'");
4073   }
4074
4075   sq_pushstring(v, "get_velocity_x", -1);
4076   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
4077   if(SQ_FAILED(sq_createslot(v, -3))) {
4078     throw SquirrelError(v, "Couldn't register function 'get_velocity_x'");
4079   }
4080
4081   sq_pushstring(v, "get_velocity_y", -1);
4082   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
4083   if(SQ_FAILED(sq_createslot(v, -3))) {
4084     throw SquirrelError(v, "Couldn't register function 'get_velocity_y'");
4085   }
4086
4087   sq_pushstring(v, "set_visible", -1);
4088   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
4089   if(SQ_FAILED(sq_createslot(v, -3))) {
4090     throw SquirrelError(v, "Couldn't register function 'set_visible'");
4091   }
4092
4093   sq_pushstring(v, "is_visible", -1);
4094   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
4095   if(SQ_FAILED(sq_createslot(v, -3))) {
4096     throw SquirrelError(v, "Couldn't register function 'is_visible'");
4097   }
4098
4099   sq_pushstring(v, "set_solid", -1);
4100   sq_newclosure(v, &ScriptedObject_set_solid_wrapper, 0);
4101   if(SQ_FAILED(sq_createslot(v, -3))) {
4102     throw SquirrelError(v, "Couldn't register function 'set_solid'");
4103   }
4104
4105   sq_pushstring(v, "is_solid", -1);
4106   sq_newclosure(v, &ScriptedObject_is_solid_wrapper, 0);
4107   if(SQ_FAILED(sq_createslot(v, -3))) {
4108     throw SquirrelError(v, "Couldn't register function 'is_solid'");
4109   }
4110
4111   sq_pushstring(v, "get_name", -1);
4112   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
4113   if(SQ_FAILED(sq_createslot(v, -3))) {
4114     throw SquirrelError(v, "Couldn't register function 'get_name'");
4115   }
4116
4117   if(SQ_FAILED(sq_createslot(v, -3))) {
4118     throw SquirrelError(v, "Couldn't register class 'ScriptedObject'");
4119   }
4120
4121   // Register class Text
4122   sq_pushstring(v, "Text", -1);
4123   if(sq_newclass(v, SQFalse) < 0) {
4124     std::ostringstream msg;
4125     msg << "Couldn't create new class 'Text'";
4126     throw SquirrelError(v, msg.str());
4127   }
4128   sq_pushstring(v, "set_text", -1);
4129   sq_newclosure(v, &Text_set_text_wrapper, 0);
4130   if(SQ_FAILED(sq_createslot(v, -3))) {
4131     throw SquirrelError(v, "Couldn't register function 'set_text'");
4132   }
4133
4134   sq_pushstring(v, "set_font", -1);
4135   sq_newclosure(v, &Text_set_font_wrapper, 0);
4136   if(SQ_FAILED(sq_createslot(v, -3))) {
4137     throw SquirrelError(v, "Couldn't register function 'set_font'");
4138   }
4139
4140   sq_pushstring(v, "fade_in", -1);
4141   sq_newclosure(v, &Text_fade_in_wrapper, 0);
4142   if(SQ_FAILED(sq_createslot(v, -3))) {
4143     throw SquirrelError(v, "Couldn't register function 'fade_in'");
4144   }
4145
4146   sq_pushstring(v, "fade_out", -1);
4147   sq_newclosure(v, &Text_fade_out_wrapper, 0);
4148   if(SQ_FAILED(sq_createslot(v, -3))) {
4149     throw SquirrelError(v, "Couldn't register function 'fade_out'");
4150   }
4151
4152   sq_pushstring(v, "set_visible", -1);
4153   sq_newclosure(v, &Text_set_visible_wrapper, 0);
4154   if(SQ_FAILED(sq_createslot(v, -3))) {
4155     throw SquirrelError(v, "Couldn't register function 'set_visible'");
4156   }
4157
4158   sq_pushstring(v, "set_centered", -1);
4159   sq_newclosure(v, &Text_set_centered_wrapper, 0);
4160   if(SQ_FAILED(sq_createslot(v, -3))) {
4161     throw SquirrelError(v, "Couldn't register function 'set_centered'");
4162   }
4163
4164   if(SQ_FAILED(sq_createslot(v, -3))) {
4165     throw SquirrelError(v, "Couldn't register class 'Text'");
4166   }
4167
4168   // Register class Player
4169   sq_pushstring(v, "Player", -1);
4170   if(sq_newclass(v, SQFalse) < 0) {
4171     std::ostringstream msg;
4172     msg << "Couldn't create new class 'Player'";
4173     throw SquirrelError(v, msg.str());
4174   }
4175   sq_pushstring(v, "add_bonus", -1);
4176   sq_newclosure(v, &Player_add_bonus_wrapper, 0);
4177   if(SQ_FAILED(sq_createslot(v, -3))) {
4178     throw SquirrelError(v, "Couldn't register function 'add_bonus'");
4179   }
4180
4181   sq_pushstring(v, "add_coins", -1);
4182   sq_newclosure(v, &Player_add_coins_wrapper, 0);
4183   if(SQ_FAILED(sq_createslot(v, -3))) {
4184     throw SquirrelError(v, "Couldn't register function 'add_coins'");
4185   }
4186
4187   sq_pushstring(v, "make_invincible", -1);
4188   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
4189   if(SQ_FAILED(sq_createslot(v, -3))) {
4190     throw SquirrelError(v, "Couldn't register function 'make_invincible'");
4191   }
4192
4193   sq_pushstring(v, "deactivate", -1);
4194   sq_newclosure(v, &Player_deactivate_wrapper, 0);
4195   if(SQ_FAILED(sq_createslot(v, -3))) {
4196     throw SquirrelError(v, "Couldn't register function 'deactivate'");
4197   }
4198
4199   sq_pushstring(v, "activate", -1);
4200   sq_newclosure(v, &Player_activate_wrapper, 0);
4201   if(SQ_FAILED(sq_createslot(v, -3))) {
4202     throw SquirrelError(v, "Couldn't register function 'activate'");
4203   }
4204
4205   sq_pushstring(v, "walk", -1);
4206   sq_newclosure(v, &Player_walk_wrapper, 0);
4207   if(SQ_FAILED(sq_createslot(v, -3))) {
4208     throw SquirrelError(v, "Couldn't register function 'walk'");
4209   }
4210
4211   sq_pushstring(v, "set_visible", -1);
4212   sq_newclosure(v, &Player_set_visible_wrapper, 0);
4213   if(SQ_FAILED(sq_createslot(v, -3))) {
4214     throw SquirrelError(v, "Couldn't register function 'set_visible'");
4215   }
4216
4217   sq_pushstring(v, "get_visible", -1);
4218   sq_newclosure(v, &Player_get_visible_wrapper, 0);
4219   if(SQ_FAILED(sq_createslot(v, -3))) {
4220     throw SquirrelError(v, "Couldn't register function 'get_visible'");
4221   }
4222
4223   sq_pushstring(v, "kill", -1);
4224   sq_newclosure(v, &Player_kill_wrapper, 0);
4225   if(SQ_FAILED(sq_createslot(v, -3))) {
4226     throw SquirrelError(v, "Couldn't register function 'kill'");
4227   }
4228
4229   sq_pushstring(v, "set_ghost_mode", -1);
4230   sq_newclosure(v, &Player_set_ghost_mode_wrapper, 0);
4231   if(SQ_FAILED(sq_createslot(v, -3))) {
4232     throw SquirrelError(v, "Couldn't register function 'set_ghost_mode'");
4233   }
4234
4235   sq_pushstring(v, "get_ghost_mode", -1);
4236   sq_newclosure(v, &Player_get_ghost_mode_wrapper, 0);
4237   if(SQ_FAILED(sq_createslot(v, -3))) {
4238     throw SquirrelError(v, "Couldn't register function 'get_ghost_mode'");
4239   }
4240
4241   sq_pushstring(v, "do_cheer", -1);
4242   sq_newclosure(v, &Player_do_cheer_wrapper, 0);
4243   if(SQ_FAILED(sq_createslot(v, -3))) {
4244     throw SquirrelError(v, "Couldn't register function 'do_cheer'");
4245   }
4246
4247   sq_pushstring(v, "do_duck", -1);
4248   sq_newclosure(v, &Player_do_duck_wrapper, 0);
4249   if(SQ_FAILED(sq_createslot(v, -3))) {
4250     throw SquirrelError(v, "Couldn't register function 'do_duck'");
4251   }
4252
4253   sq_pushstring(v, "do_standup", -1);
4254   sq_newclosure(v, &Player_do_standup_wrapper, 0);
4255   if(SQ_FAILED(sq_createslot(v, -3))) {
4256     throw SquirrelError(v, "Couldn't register function 'do_standup'");
4257   }
4258
4259   sq_pushstring(v, "do_backflip", -1);
4260   sq_newclosure(v, &Player_do_backflip_wrapper, 0);
4261   if(SQ_FAILED(sq_createslot(v, -3))) {
4262     throw SquirrelError(v, "Couldn't register function 'do_backflip'");
4263   }
4264
4265   sq_pushstring(v, "do_jump", -1);
4266   sq_newclosure(v, &Player_do_jump_wrapper, 0);
4267   if(SQ_FAILED(sq_createslot(v, -3))) {
4268     throw SquirrelError(v, "Couldn't register function 'do_jump'");
4269   }
4270
4271   sq_pushstring(v, "trigger_sequence", -1);
4272   sq_newclosure(v, &Player_trigger_sequence_wrapper, 0);
4273   if(SQ_FAILED(sq_createslot(v, -3))) {
4274     throw SquirrelError(v, "Couldn't register function 'trigger_sequence'");
4275   }
4276
4277   if(SQ_FAILED(sq_createslot(v, -3))) {
4278     throw SquirrelError(v, "Couldn't register class 'Player'");
4279   }
4280
4281   // Register class FloatingImage
4282   sq_pushstring(v, "FloatingImage", -1);
4283   if(sq_newclass(v, SQFalse) < 0) {
4284     std::ostringstream msg;
4285     msg << "Couldn't create new class 'FloatingImage'";
4286     throw SquirrelError(v, msg.str());
4287   }
4288   sq_pushstring(v, "constructor", -1);
4289   sq_newclosure(v, &FloatingImage_constructor_wrapper, 0);
4290   if(SQ_FAILED(sq_createslot(v, -3))) {
4291     throw SquirrelError(v, "Couldn't register function 'constructor'");
4292   }
4293
4294   sq_pushstring(v, "set_layer", -1);
4295   sq_newclosure(v, &FloatingImage_set_layer_wrapper, 0);
4296   if(SQ_FAILED(sq_createslot(v, -3))) {
4297     throw SquirrelError(v, "Couldn't register function 'set_layer'");
4298   }
4299
4300   sq_pushstring(v, "get_layer", -1);
4301   sq_newclosure(v, &FloatingImage_get_layer_wrapper, 0);
4302   if(SQ_FAILED(sq_createslot(v, -3))) {
4303     throw SquirrelError(v, "Couldn't register function 'get_layer'");
4304   }
4305
4306   sq_pushstring(v, "set_pos", -1);
4307   sq_newclosure(v, &FloatingImage_set_pos_wrapper, 0);
4308   if(SQ_FAILED(sq_createslot(v, -3))) {
4309     throw SquirrelError(v, "Couldn't register function 'set_pos'");
4310   }
4311
4312   sq_pushstring(v, "get_pos_x", -1);
4313   sq_newclosure(v, &FloatingImage_get_pos_x_wrapper, 0);
4314   if(SQ_FAILED(sq_createslot(v, -3))) {
4315     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
4316   }
4317
4318   sq_pushstring(v, "get_pos_y", -1);
4319   sq_newclosure(v, &FloatingImage_get_pos_y_wrapper, 0);
4320   if(SQ_FAILED(sq_createslot(v, -3))) {
4321     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
4322   }
4323
4324   sq_pushstring(v, "set_anchor_point", -1);
4325   sq_newclosure(v, &FloatingImage_set_anchor_point_wrapper, 0);
4326   if(SQ_FAILED(sq_createslot(v, -3))) {
4327     throw SquirrelError(v, "Couldn't register function 'set_anchor_point'");
4328   }
4329
4330   sq_pushstring(v, "get_anchor_point", -1);
4331   sq_newclosure(v, &FloatingImage_get_anchor_point_wrapper, 0);
4332   if(SQ_FAILED(sq_createslot(v, -3))) {
4333     throw SquirrelError(v, "Couldn't register function 'get_anchor_point'");
4334   }
4335
4336   sq_pushstring(v, "set_visible", -1);
4337   sq_newclosure(v, &FloatingImage_set_visible_wrapper, 0);
4338   if(SQ_FAILED(sq_createslot(v, -3))) {
4339     throw SquirrelError(v, "Couldn't register function 'set_visible'");
4340   }
4341
4342   sq_pushstring(v, "get_visible", -1);
4343   sq_newclosure(v, &FloatingImage_get_visible_wrapper, 0);
4344   if(SQ_FAILED(sq_createslot(v, -3))) {
4345     throw SquirrelError(v, "Couldn't register function 'get_visible'");
4346   }
4347
4348   sq_pushstring(v, "set_action", -1);
4349   sq_newclosure(v, &FloatingImage_set_action_wrapper, 0);
4350   if(SQ_FAILED(sq_createslot(v, -3))) {
4351     throw SquirrelError(v, "Couldn't register function 'set_action'");
4352   }
4353
4354   sq_pushstring(v, "get_action", -1);
4355   sq_newclosure(v, &FloatingImage_get_action_wrapper, 0);
4356   if(SQ_FAILED(sq_createslot(v, -3))) {
4357     throw SquirrelError(v, "Couldn't register function 'get_action'");
4358   }
4359
4360   sq_pushstring(v, "fade_in", -1);
4361   sq_newclosure(v, &FloatingImage_fade_in_wrapper, 0);
4362   if(SQ_FAILED(sq_createslot(v, -3))) {
4363     throw SquirrelError(v, "Couldn't register function 'fade_in'");
4364   }
4365
4366   sq_pushstring(v, "fade_out", -1);
4367   sq_newclosure(v, &FloatingImage_fade_out_wrapper, 0);
4368   if(SQ_FAILED(sq_createslot(v, -3))) {
4369     throw SquirrelError(v, "Couldn't register function 'fade_out'");
4370   }
4371
4372   if(SQ_FAILED(sq_createslot(v, -3))) {
4373     throw SquirrelError(v, "Couldn't register class 'FloatingImage'");
4374   }
4375
4376   // Register class Platform
4377   sq_pushstring(v, "Platform", -1);
4378   if(sq_newclass(v, SQFalse) < 0) {
4379     std::ostringstream msg;
4380     msg << "Couldn't create new class 'Platform'";
4381     throw SquirrelError(v, msg.str());
4382   }
4383   sq_pushstring(v, "goto_node", -1);
4384   sq_newclosure(v, &Platform_goto_node_wrapper, 0);
4385   if(SQ_FAILED(sq_createslot(v, -3))) {
4386     throw SquirrelError(v, "Couldn't register function 'goto_node'");
4387   }
4388
4389   sq_pushstring(v, "start_moving", -1);
4390   sq_newclosure(v, &Platform_start_moving_wrapper, 0);
4391   if(SQ_FAILED(sq_createslot(v, -3))) {
4392     throw SquirrelError(v, "Couldn't register function 'start_moving'");
4393   }
4394
4395   sq_pushstring(v, "stop_moving", -1);
4396   sq_newclosure(v, &Platform_stop_moving_wrapper, 0);
4397   if(SQ_FAILED(sq_createslot(v, -3))) {
4398     throw SquirrelError(v, "Couldn't register function 'stop_moving'");
4399   }
4400
4401   if(SQ_FAILED(sq_createslot(v, -3))) {
4402     throw SquirrelError(v, "Couldn't register class 'Platform'");
4403   }
4404
4405   // Register class Candle
4406   sq_pushstring(v, "Candle", -1);
4407   if(sq_newclass(v, SQFalse) < 0) {
4408     std::ostringstream msg;
4409     msg << "Couldn't create new class 'Candle'";
4410     throw SquirrelError(v, msg.str());
4411   }
4412   sq_pushstring(v, "get_burning", -1);
4413   sq_newclosure(v, &Candle_get_burning_wrapper, 0);
4414   if(SQ_FAILED(sq_createslot(v, -3))) {
4415     throw SquirrelError(v, "Couldn't register function 'get_burning'");
4416   }
4417
4418   sq_pushstring(v, "set_burning", -1);
4419   sq_newclosure(v, &Candle_set_burning_wrapper, 0);
4420   if(SQ_FAILED(sq_createslot(v, -3))) {
4421     throw SquirrelError(v, "Couldn't register function 'set_burning'");
4422   }
4423
4424   if(SQ_FAILED(sq_createslot(v, -3))) {
4425     throw SquirrelError(v, "Couldn't register class 'Candle'");
4426   }
4427
4428   // Register class Wind
4429   sq_pushstring(v, "Wind", -1);
4430   if(sq_newclass(v, SQFalse) < 0) {
4431     std::ostringstream msg;
4432     msg << "Couldn't create new class 'Wind'";
4433     throw SquirrelError(v, msg.str());
4434   }
4435   sq_pushstring(v, "start", -1);
4436   sq_newclosure(v, &Wind_start_wrapper, 0);
4437   if(SQ_FAILED(sq_createslot(v, -3))) {
4438     throw SquirrelError(v, "Couldn't register function 'start'");
4439   }
4440
4441   sq_pushstring(v, "stop", -1);
4442   sq_newclosure(v, &Wind_stop_wrapper, 0);
4443   if(SQ_FAILED(sq_createslot(v, -3))) {
4444     throw SquirrelError(v, "Couldn't register function 'stop'");
4445   }
4446
4447   if(SQ_FAILED(sq_createslot(v, -3))) {
4448     throw SquirrelError(v, "Couldn't register class 'Wind'");
4449   }
4450
4451   // Register class AmbientSound
4452   sq_pushstring(v, "AmbientSound", -1);
4453   if(sq_newclass(v, SQFalse) < 0) {
4454     std::ostringstream msg;
4455     msg << "Couldn't create new class 'AmbientSound'";
4456     throw SquirrelError(v, msg.str());
4457   }
4458   sq_pushstring(v, "set_pos", -1);
4459   sq_newclosure(v, &AmbientSound_set_pos_wrapper, 0);
4460   if(SQ_FAILED(sq_createslot(v, -3))) {
4461     throw SquirrelError(v, "Couldn't register function 'set_pos'");
4462   }
4463
4464   sq_pushstring(v, "get_pos_x", -1);
4465   sq_newclosure(v, &AmbientSound_get_pos_x_wrapper, 0);
4466   if(SQ_FAILED(sq_createslot(v, -3))) {
4467     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
4468   }
4469
4470   sq_pushstring(v, "get_pos_y", -1);
4471   sq_newclosure(v, &AmbientSound_get_pos_y_wrapper, 0);
4472   if(SQ_FAILED(sq_createslot(v, -3))) {
4473     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
4474   }
4475
4476   if(SQ_FAILED(sq_createslot(v, -3))) {
4477     throw SquirrelError(v, "Couldn't register class 'AmbientSound'");
4478   }
4479
4480   // Register class Thunderstorm
4481   sq_pushstring(v, "Thunderstorm", -1);
4482   if(sq_newclass(v, SQFalse) < 0) {
4483     std::ostringstream msg;
4484     msg << "Couldn't create new class 'Thunderstorm'";
4485     throw SquirrelError(v, msg.str());
4486   }
4487   sq_pushstring(v, "start", -1);
4488   sq_newclosure(v, &Thunderstorm_start_wrapper, 0);
4489   if(SQ_FAILED(sq_createslot(v, -3))) {
4490     throw SquirrelError(v, "Couldn't register function 'start'");
4491   }
4492
4493   sq_pushstring(v, "stop", -1);
4494   sq_newclosure(v, &Thunderstorm_stop_wrapper, 0);
4495   if(SQ_FAILED(sq_createslot(v, -3))) {
4496     throw SquirrelError(v, "Couldn't register function 'stop'");
4497   }
4498
4499   sq_pushstring(v, "thunder", -1);
4500   sq_newclosure(v, &Thunderstorm_thunder_wrapper, 0);
4501   if(SQ_FAILED(sq_createslot(v, -3))) {
4502     throw SquirrelError(v, "Couldn't register function 'thunder'");
4503   }
4504
4505   sq_pushstring(v, "lightning", -1);
4506   sq_newclosure(v, &Thunderstorm_lightning_wrapper, 0);
4507   if(SQ_FAILED(sq_createslot(v, -3))) {
4508     throw SquirrelError(v, "Couldn't register function 'lightning'");
4509   }
4510
4511   sq_pushstring(v, "flash", -1);
4512   sq_newclosure(v, &Thunderstorm_flash_wrapper, 0);
4513   if(SQ_FAILED(sq_createslot(v, -3))) {
4514     throw SquirrelError(v, "Couldn't register function 'flash'");
4515   }
4516
4517   sq_pushstring(v, "electrify", -1);
4518   sq_newclosure(v, &Thunderstorm_electrify_wrapper, 0);
4519   if(SQ_FAILED(sq_createslot(v, -3))) {
4520     throw SquirrelError(v, "Couldn't register function 'electrify'");
4521   }
4522
4523   if(SQ_FAILED(sq_createslot(v, -3))) {
4524     throw SquirrelError(v, "Couldn't register class 'Thunderstorm'");
4525   }
4526
4527   // Register class TileMap
4528   sq_pushstring(v, "TileMap", -1);
4529   if(sq_newclass(v, SQFalse) < 0) {
4530     std::ostringstream msg;
4531     msg << "Couldn't create new class 'TileMap'";
4532     throw SquirrelError(v, msg.str());
4533   }
4534   sq_pushstring(v, "goto_node", -1);
4535   sq_newclosure(v, &TileMap_goto_node_wrapper, 0);
4536   if(SQ_FAILED(sq_createslot(v, -3))) {
4537     throw SquirrelError(v, "Couldn't register function 'goto_node'");
4538   }
4539
4540   sq_pushstring(v, "start_moving", -1);
4541   sq_newclosure(v, &TileMap_start_moving_wrapper, 0);
4542   if(SQ_FAILED(sq_createslot(v, -3))) {
4543     throw SquirrelError(v, "Couldn't register function 'start_moving'");
4544   }
4545
4546   sq_pushstring(v, "stop_moving", -1);
4547   sq_newclosure(v, &TileMap_stop_moving_wrapper, 0);
4548   if(SQ_FAILED(sq_createslot(v, -3))) {
4549     throw SquirrelError(v, "Couldn't register function 'stop_moving'");
4550   }
4551
4552   if(SQ_FAILED(sq_createslot(v, -3))) {
4553     throw SquirrelError(v, "Couldn't register class 'TileMap'");
4554   }
4555
4556   // Register class SSector
4557   sq_pushstring(v, "SSector", -1);
4558   if(sq_newclass(v, SQFalse) < 0) {
4559     std::ostringstream msg;
4560     msg << "Couldn't create new class 'SSector'";
4561     throw SquirrelError(v, msg.str());
4562   }
4563   sq_pushstring(v, "set_ambient_light", -1);
4564   sq_newclosure(v, &SSector_set_ambient_light_wrapper, 0);
4565   if(SQ_FAILED(sq_createslot(v, -3))) {
4566     throw SquirrelError(v, "Couldn't register function 'set_ambient_light'");
4567   }
4568
4569   sq_pushstring(v, "get_ambient_red", -1);
4570   sq_newclosure(v, &SSector_get_ambient_red_wrapper, 0);
4571   if(SQ_FAILED(sq_createslot(v, -3))) {
4572     throw SquirrelError(v, "Couldn't register function 'get_ambient_red'");
4573   }
4574
4575   sq_pushstring(v, "get_ambient_green", -1);
4576   sq_newclosure(v, &SSector_get_ambient_green_wrapper, 0);
4577   if(SQ_FAILED(sq_createslot(v, -3))) {
4578     throw SquirrelError(v, "Couldn't register function 'get_ambient_green'");
4579   }
4580
4581   sq_pushstring(v, "get_ambient_blue", -1);
4582   sq_newclosure(v, &SSector_get_ambient_blue_wrapper, 0);
4583   if(SQ_FAILED(sq_createslot(v, -3))) {
4584     throw SquirrelError(v, "Couldn't register function 'get_ambient_blue'");
4585   }
4586
4587   if(SQ_FAILED(sq_createslot(v, -3))) {
4588     throw SquirrelError(v, "Couldn't register class 'SSector'");
4589   }
4590
4591   // Register class LevelTime
4592   sq_pushstring(v, "LevelTime", -1);
4593   if(sq_newclass(v, SQFalse) < 0) {
4594     std::ostringstream msg;
4595     msg << "Couldn't create new class 'LevelTime'";
4596     throw SquirrelError(v, msg.str());
4597   }
4598   sq_pushstring(v, "start", -1);
4599   sq_newclosure(v, &LevelTime_start_wrapper, 0);
4600   if(SQ_FAILED(sq_createslot(v, -3))) {
4601     throw SquirrelError(v, "Couldn't register function 'start'");
4602   }
4603
4604   sq_pushstring(v, "stop", -1);
4605   sq_newclosure(v, &LevelTime_stop_wrapper, 0);
4606   if(SQ_FAILED(sq_createslot(v, -3))) {
4607     throw SquirrelError(v, "Couldn't register function 'stop'");
4608   }
4609
4610   sq_pushstring(v, "get_time", -1);
4611   sq_newclosure(v, &LevelTime_get_time_wrapper, 0);
4612   if(SQ_FAILED(sq_createslot(v, -3))) {
4613     throw SquirrelError(v, "Couldn't register function 'get_time'");
4614   }
4615
4616   sq_pushstring(v, "set_time", -1);
4617   sq_newclosure(v, &LevelTime_set_time_wrapper, 0);
4618   if(SQ_FAILED(sq_createslot(v, -3))) {
4619     throw SquirrelError(v, "Couldn't register function 'set_time'");
4620   }
4621
4622   if(SQ_FAILED(sq_createslot(v, -3))) {
4623     throw SquirrelError(v, "Couldn't register class 'LevelTime'");
4624   }
4625
4626 }
4627
4628 } // end of namespace Scripting