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