f914a3347623642cb420330eacbf747ec20812f9
[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 int DisplayEffect_release_hook(SQUserPointer ptr, int )
22 {
23   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (ptr);
24   delete _this;
25   return 0;
26 }
27
28 static int DisplayEffect_fade_out_wrapper(HSQUIRRELVM vm)
29 {
30   Scripting::DisplayEffect* _this;
31   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
32     sq_throwerror(vm, _SC("'fade_out' called without instance"));
33     return SQ_ERROR;
34   }
35   float arg0;
36   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
37     sq_throwerror(vm, _SC("Argument 1 not a float"));
38     return SQ_ERROR;
39   }
40   
41   try {
42     _this->fade_out(arg0);
43   
44     return 0;
45   
46   } catch(std::exception& e) {
47     sq_throwerror(vm, e.what());
48     return SQ_ERROR;
49   } catch(...) {
50     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
51     return SQ_ERROR;
52   }
53   
54 }
55
56 static int DisplayEffect_fade_in_wrapper(HSQUIRRELVM vm)
57 {
58   Scripting::DisplayEffect* _this;
59   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
60     sq_throwerror(vm, _SC("'fade_in' called without instance"));
61     return SQ_ERROR;
62   }
63   float arg0;
64   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
65     sq_throwerror(vm, _SC("Argument 1 not a float"));
66     return SQ_ERROR;
67   }
68   
69   try {
70     _this->fade_in(arg0);
71   
72     return 0;
73   
74   } catch(std::exception& e) {
75     sq_throwerror(vm, e.what());
76     return SQ_ERROR;
77   } catch(...) {
78     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
79     return SQ_ERROR;
80   }
81   
82 }
83
84 static int DisplayEffect_set_black_wrapper(HSQUIRRELVM vm)
85 {
86   Scripting::DisplayEffect* _this;
87   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
88     sq_throwerror(vm, _SC("'set_black' called without instance"));
89     return SQ_ERROR;
90   }
91   SQBool arg0;
92   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
93     sq_throwerror(vm, _SC("Argument 1 not a bool"));
94     return SQ_ERROR;
95   }
96   
97   try {
98     _this->set_black(arg0);
99   
100     return 0;
101   
102   } catch(std::exception& e) {
103     sq_throwerror(vm, e.what());
104     return SQ_ERROR;
105   } catch(...) {
106     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_black'"));
107     return SQ_ERROR;
108   }
109   
110 }
111
112 static int DisplayEffect_is_black_wrapper(HSQUIRRELVM vm)
113 {
114   Scripting::DisplayEffect* _this;
115   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
116     sq_throwerror(vm, _SC("'is_black' called without instance"));
117     return SQ_ERROR;
118   }
119   
120   try {
121     bool return_value = _this->is_black();
122   
123     sq_pushbool(vm, return_value);
124     return 1;
125   
126   } catch(std::exception& e) {
127     sq_throwerror(vm, e.what());
128     return SQ_ERROR;
129   } catch(...) {
130     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_black'"));
131     return SQ_ERROR;
132   }
133   
134 }
135
136 static int DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM vm)
137 {
138   Scripting::DisplayEffect* _this;
139   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
140     sq_throwerror(vm, _SC("'sixteen_to_nine' called without instance"));
141     return SQ_ERROR;
142   }
143   float arg0;
144   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
145     sq_throwerror(vm, _SC("Argument 1 not a float"));
146     return SQ_ERROR;
147   }
148   
149   try {
150     _this->sixteen_to_nine(arg0);
151   
152     return 0;
153   
154   } catch(std::exception& e) {
155     sq_throwerror(vm, e.what());
156     return SQ_ERROR;
157   } catch(...) {
158     sq_throwerror(vm, _SC("Unexpected exception while executing function 'sixteen_to_nine'"));
159     return SQ_ERROR;
160   }
161   
162 }
163
164 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM vm)
165 {
166   Scripting::DisplayEffect* _this;
167   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
168     sq_throwerror(vm, _SC("'four_to_three' called without instance"));
169     return SQ_ERROR;
170   }
171   float arg0;
172   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
173     sq_throwerror(vm, _SC("Argument 1 not a float"));
174     return SQ_ERROR;
175   }
176   
177   try {
178     _this->four_to_three(arg0);
179   
180     return 0;
181   
182   } catch(std::exception& e) {
183     sq_throwerror(vm, e.what());
184     return SQ_ERROR;
185   } catch(...) {
186     sq_throwerror(vm, _SC("Unexpected exception while executing function 'four_to_three'"));
187     return SQ_ERROR;
188   }
189   
190 }
191
192 static int Camera_release_hook(SQUserPointer ptr, int )
193 {
194   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
195   delete _this;
196   return 0;
197 }
198
199 static int Camera_shake_wrapper(HSQUIRRELVM vm)
200 {
201   Scripting::Camera* _this;
202   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
203     sq_throwerror(vm, _SC("'shake' called without instance"));
204     return SQ_ERROR;
205   }
206   float arg0;
207   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
208     sq_throwerror(vm, _SC("Argument 1 not a float"));
209     return SQ_ERROR;
210   }
211   float arg1;
212   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
213     sq_throwerror(vm, _SC("Argument 2 not a float"));
214     return SQ_ERROR;
215   }
216   float arg2;
217   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
218     sq_throwerror(vm, _SC("Argument 3 not a float"));
219     return SQ_ERROR;
220   }
221   
222   try {
223     _this->shake(arg0, arg1, arg2);
224   
225     return 0;
226   
227   } catch(std::exception& e) {
228     sq_throwerror(vm, e.what());
229     return SQ_ERROR;
230   } catch(...) {
231     sq_throwerror(vm, _SC("Unexpected exception while executing function 'shake'"));
232     return SQ_ERROR;
233   }
234   
235 }
236
237 static int Camera_set_pos_wrapper(HSQUIRRELVM vm)
238 {
239   Scripting::Camera* _this;
240   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
241     sq_throwerror(vm, _SC("'set_pos' called without instance"));
242     return SQ_ERROR;
243   }
244   float arg0;
245   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
246     sq_throwerror(vm, _SC("Argument 1 not a float"));
247     return SQ_ERROR;
248   }
249   float arg1;
250   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
251     sq_throwerror(vm, _SC("Argument 2 not a float"));
252     return SQ_ERROR;
253   }
254   
255   try {
256     _this->set_pos(arg0, arg1);
257   
258     return 0;
259   
260   } catch(std::exception& e) {
261     sq_throwerror(vm, e.what());
262     return SQ_ERROR;
263   } catch(...) {
264     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
265     return SQ_ERROR;
266   }
267   
268 }
269
270 static int Camera_set_mode_wrapper(HSQUIRRELVM vm)
271 {
272   Scripting::Camera* _this;
273   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
274     sq_throwerror(vm, _SC("'set_mode' called without instance"));
275     return SQ_ERROR;
276   }
277   const char* arg0;
278   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
279     sq_throwerror(vm, _SC("Argument 1 not a string"));
280     return SQ_ERROR;
281   }
282   
283   try {
284     _this->set_mode(arg0);
285   
286     return 0;
287   
288   } catch(std::exception& e) {
289     sq_throwerror(vm, e.what());
290     return SQ_ERROR;
291   } catch(...) {
292     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_mode'"));
293     return SQ_ERROR;
294   }
295   
296 }
297
298 static int Camera_scroll_to_wrapper(HSQUIRRELVM vm)
299 {
300   Scripting::Camera* _this;
301   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
302     sq_throwerror(vm, _SC("'scroll_to' called without instance"));
303     return SQ_ERROR;
304   }
305   float arg0;
306   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
307     sq_throwerror(vm, _SC("Argument 1 not a float"));
308     return SQ_ERROR;
309   }
310   float arg1;
311   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
312     sq_throwerror(vm, _SC("Argument 2 not a float"));
313     return SQ_ERROR;
314   }
315   float arg2;
316   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
317     sq_throwerror(vm, _SC("Argument 3 not a float"));
318     return SQ_ERROR;
319   }
320   
321   try {
322     _this->scroll_to(arg0, arg1, arg2);
323   
324     return 0;
325   
326   } catch(std::exception& e) {
327     sq_throwerror(vm, e.what());
328     return SQ_ERROR;
329   } catch(...) {
330     sq_throwerror(vm, _SC("Unexpected exception while executing function 'scroll_to'"));
331     return SQ_ERROR;
332   }
333   
334 }
335
336 static int Level_release_hook(SQUserPointer ptr, int )
337 {
338   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
339   delete _this;
340   return 0;
341 }
342
343 static int Level_finish_wrapper(HSQUIRRELVM vm)
344 {
345   Scripting::Level* _this;
346   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
347     sq_throwerror(vm, _SC("'finish' called without instance"));
348     return SQ_ERROR;
349   }
350   SQBool arg0;
351   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
352     sq_throwerror(vm, _SC("Argument 1 not a bool"));
353     return SQ_ERROR;
354   }
355   
356   try {
357     _this->finish(arg0);
358   
359     return 0;
360   
361   } catch(std::exception& e) {
362     sq_throwerror(vm, e.what());
363     return SQ_ERROR;
364   } catch(...) {
365     sq_throwerror(vm, _SC("Unexpected exception while executing function 'finish'"));
366     return SQ_ERROR;
367   }
368   
369 }
370
371 static int Level_spawn_wrapper(HSQUIRRELVM vm)
372 {
373   Scripting::Level* _this;
374   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
375     sq_throwerror(vm, _SC("'spawn' called without instance"));
376     return SQ_ERROR;
377   }
378   const char* arg0;
379   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
380     sq_throwerror(vm, _SC("Argument 1 not a string"));
381     return SQ_ERROR;
382   }
383   const char* arg1;
384   if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) {
385     sq_throwerror(vm, _SC("Argument 2 not a string"));
386     return SQ_ERROR;
387   }
388   
389   try {
390     _this->spawn(arg0, arg1);
391   
392     return 0;
393   
394   } catch(std::exception& e) {
395     sq_throwerror(vm, e.what());
396     return SQ_ERROR;
397   } catch(...) {
398     sq_throwerror(vm, _SC("Unexpected exception while executing function 'spawn'"));
399     return SQ_ERROR;
400   }
401   
402 }
403
404 static int Level_flip_vertically_wrapper(HSQUIRRELVM vm)
405 {
406   Scripting::Level* _this;
407   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
408     sq_throwerror(vm, _SC("'flip_vertically' called without instance"));
409     return SQ_ERROR;
410   }
411   
412   try {
413     _this->flip_vertically();
414   
415     return 0;
416   
417   } catch(std::exception& e) {
418     sq_throwerror(vm, e.what());
419     return SQ_ERROR;
420   } catch(...) {
421     sq_throwerror(vm, _SC("Unexpected exception while executing function 'flip_vertically'"));
422     return SQ_ERROR;
423   }
424   
425 }
426
427 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
428 {
429   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
430   delete _this;
431   return 0;
432 }
433
434 static int ScriptedObject_set_action_wrapper(HSQUIRRELVM vm)
435 {
436   Scripting::ScriptedObject* _this;
437   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
438     sq_throwerror(vm, _SC("'set_action' called without instance"));
439     return SQ_ERROR;
440   }
441   const char* arg0;
442   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
443     sq_throwerror(vm, _SC("Argument 1 not a string"));
444     return SQ_ERROR;
445   }
446   
447   try {
448     _this->set_action(arg0);
449   
450     return 0;
451   
452   } catch(std::exception& e) {
453     sq_throwerror(vm, e.what());
454     return SQ_ERROR;
455   } catch(...) {
456     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_action'"));
457     return SQ_ERROR;
458   }
459   
460 }
461
462 static int ScriptedObject_get_action_wrapper(HSQUIRRELVM vm)
463 {
464   Scripting::ScriptedObject* _this;
465   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
466     sq_throwerror(vm, _SC("'get_action' called without instance"));
467     return SQ_ERROR;
468   }
469   
470   try {
471     std::string return_value = _this->get_action();
472   
473     sq_pushstring(vm, return_value.c_str(), return_value.size());
474     return 1;
475   
476   } catch(std::exception& e) {
477     sq_throwerror(vm, e.what());
478     return SQ_ERROR;
479   } catch(...) {
480     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_action'"));
481     return SQ_ERROR;
482   }
483   
484 }
485
486 static int ScriptedObject_move_wrapper(HSQUIRRELVM vm)
487 {
488   Scripting::ScriptedObject* _this;
489   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
490     sq_throwerror(vm, _SC("'move' called without instance"));
491     return SQ_ERROR;
492   }
493   float arg0;
494   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
495     sq_throwerror(vm, _SC("Argument 1 not a float"));
496     return SQ_ERROR;
497   }
498   float arg1;
499   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
500     sq_throwerror(vm, _SC("Argument 2 not a float"));
501     return SQ_ERROR;
502   }
503   
504   try {
505     _this->move(arg0, arg1);
506   
507     return 0;
508   
509   } catch(std::exception& e) {
510     sq_throwerror(vm, e.what());
511     return SQ_ERROR;
512   } catch(...) {
513     sq_throwerror(vm, _SC("Unexpected exception while executing function 'move'"));
514     return SQ_ERROR;
515   }
516   
517 }
518
519 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM vm)
520 {
521   Scripting::ScriptedObject* _this;
522   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
523     sq_throwerror(vm, _SC("'set_pos' called without instance"));
524     return SQ_ERROR;
525   }
526   float arg0;
527   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
528     sq_throwerror(vm, _SC("Argument 1 not a float"));
529     return SQ_ERROR;
530   }
531   float arg1;
532   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
533     sq_throwerror(vm, _SC("Argument 2 not a float"));
534     return SQ_ERROR;
535   }
536   
537   try {
538     _this->set_pos(arg0, arg1);
539   
540     return 0;
541   
542   } catch(std::exception& e) {
543     sq_throwerror(vm, e.what());
544     return SQ_ERROR;
545   } catch(...) {
546     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
547     return SQ_ERROR;
548   }
549   
550 }
551
552 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM vm)
553 {
554   Scripting::ScriptedObject* _this;
555   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
556     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
557     return SQ_ERROR;
558   }
559   
560   try {
561     float return_value = _this->get_pos_x();
562   
563     sq_pushfloat(vm, return_value);
564     return 1;
565   
566   } catch(std::exception& e) {
567     sq_throwerror(vm, e.what());
568     return SQ_ERROR;
569   } catch(...) {
570     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
571     return SQ_ERROR;
572   }
573   
574 }
575
576 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM vm)
577 {
578   Scripting::ScriptedObject* _this;
579   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
580     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
581     return SQ_ERROR;
582   }
583   
584   try {
585     float return_value = _this->get_pos_y();
586   
587     sq_pushfloat(vm, return_value);
588     return 1;
589   
590   } catch(std::exception& e) {
591     sq_throwerror(vm, e.what());
592     return SQ_ERROR;
593   } catch(...) {
594     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
595     return SQ_ERROR;
596   }
597   
598 }
599
600 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM vm)
601 {
602   Scripting::ScriptedObject* _this;
603   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
604     sq_throwerror(vm, _SC("'set_velocity' called without instance"));
605     return SQ_ERROR;
606   }
607   float arg0;
608   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
609     sq_throwerror(vm, _SC("Argument 1 not a float"));
610     return SQ_ERROR;
611   }
612   float arg1;
613   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
614     sq_throwerror(vm, _SC("Argument 2 not a float"));
615     return SQ_ERROR;
616   }
617   
618   try {
619     _this->set_velocity(arg0, arg1);
620   
621     return 0;
622   
623   } catch(std::exception& e) {
624     sq_throwerror(vm, e.what());
625     return SQ_ERROR;
626   } catch(...) {
627     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_velocity'"));
628     return SQ_ERROR;
629   }
630   
631 }
632
633 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM vm)
634 {
635   Scripting::ScriptedObject* _this;
636   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
637     sq_throwerror(vm, _SC("'get_velocity_x' called without instance"));
638     return SQ_ERROR;
639   }
640   
641   try {
642     float return_value = _this->get_velocity_x();
643   
644     sq_pushfloat(vm, return_value);
645     return 1;
646   
647   } catch(std::exception& e) {
648     sq_throwerror(vm, e.what());
649     return SQ_ERROR;
650   } catch(...) {
651     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_x'"));
652     return SQ_ERROR;
653   }
654   
655 }
656
657 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM vm)
658 {
659   Scripting::ScriptedObject* _this;
660   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
661     sq_throwerror(vm, _SC("'get_velocity_y' called without instance"));
662     return SQ_ERROR;
663   }
664   
665   try {
666     float return_value = _this->get_velocity_y();
667   
668     sq_pushfloat(vm, return_value);
669     return 1;
670   
671   } catch(std::exception& e) {
672     sq_throwerror(vm, e.what());
673     return SQ_ERROR;
674   } catch(...) {
675     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_y'"));
676     return SQ_ERROR;
677   }
678   
679 }
680
681 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM vm)
682 {
683   Scripting::ScriptedObject* _this;
684   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
685     sq_throwerror(vm, _SC("'set_visible' called without instance"));
686     return SQ_ERROR;
687   }
688   SQBool arg0;
689   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
690     sq_throwerror(vm, _SC("Argument 1 not a bool"));
691     return SQ_ERROR;
692   }
693   
694   try {
695     _this->set_visible(arg0);
696   
697     return 0;
698   
699   } catch(std::exception& e) {
700     sq_throwerror(vm, e.what());
701     return SQ_ERROR;
702   } catch(...) {
703     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
704     return SQ_ERROR;
705   }
706   
707 }
708
709 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM vm)
710 {
711   Scripting::ScriptedObject* _this;
712   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
713     sq_throwerror(vm, _SC("'is_visible' called without instance"));
714     return SQ_ERROR;
715   }
716   
717   try {
718     bool return_value = _this->is_visible();
719   
720     sq_pushbool(vm, return_value);
721     return 1;
722   
723   } catch(std::exception& e) {
724     sq_throwerror(vm, e.what());
725     return SQ_ERROR;
726   } catch(...) {
727     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_visible'"));
728     return SQ_ERROR;
729   }
730   
731 }
732
733 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM vm)
734 {
735   Scripting::ScriptedObject* _this;
736   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
737     sq_throwerror(vm, _SC("'get_name' called without instance"));
738     return SQ_ERROR;
739   }
740   
741   try {
742     std::string return_value = _this->get_name();
743   
744     sq_pushstring(vm, return_value.c_str(), return_value.size());
745     return 1;
746   
747   } catch(std::exception& e) {
748     sq_throwerror(vm, e.what());
749     return SQ_ERROR;
750   } catch(...) {
751     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_name'"));
752     return SQ_ERROR;
753   }
754   
755 }
756
757 static int Sound_release_hook(SQUserPointer ptr, int )
758 {
759   Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
760   delete _this;
761   return 0;
762 }
763
764 static int Sound_play_music_wrapper(HSQUIRRELVM vm)
765 {
766   Scripting::Sound* _this;
767   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
768     sq_throwerror(vm, _SC("'play_music' called without instance"));
769     return SQ_ERROR;
770   }
771   const char* arg0;
772   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
773     sq_throwerror(vm, _SC("Argument 1 not a string"));
774     return SQ_ERROR;
775   }
776   
777   try {
778     _this->play_music(arg0);
779   
780     return 0;
781   
782   } catch(std::exception& e) {
783     sq_throwerror(vm, e.what());
784     return SQ_ERROR;
785   } catch(...) {
786     sq_throwerror(vm, _SC("Unexpected exception while executing function 'play_music'"));
787     return SQ_ERROR;
788   }
789   
790 }
791
792 static int Sound_play_wrapper(HSQUIRRELVM vm)
793 {
794   Scripting::Sound* _this;
795   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
796     sq_throwerror(vm, _SC("'play' called without instance"));
797     return SQ_ERROR;
798   }
799   const char* arg0;
800   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
801     sq_throwerror(vm, _SC("Argument 1 not a string"));
802     return SQ_ERROR;
803   }
804   
805   try {
806     _this->play(arg0);
807   
808     return 0;
809   
810   } catch(std::exception& e) {
811     sq_throwerror(vm, e.what());
812     return SQ_ERROR;
813   } catch(...) {
814     sq_throwerror(vm, _SC("Unexpected exception while executing function 'play'"));
815     return SQ_ERROR;
816   }
817   
818 }
819
820 static int Text_release_hook(SQUserPointer ptr, int )
821 {
822   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
823   delete _this;
824   return 0;
825 }
826
827 static int Text_set_text_wrapper(HSQUIRRELVM vm)
828 {
829   Scripting::Text* _this;
830   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
831     sq_throwerror(vm, _SC("'set_text' called without instance"));
832     return SQ_ERROR;
833   }
834   const char* arg0;
835   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
836     sq_throwerror(vm, _SC("Argument 1 not a string"));
837     return SQ_ERROR;
838   }
839   
840   try {
841     _this->set_text(arg0);
842   
843     return 0;
844   
845   } catch(std::exception& e) {
846     sq_throwerror(vm, e.what());
847     return SQ_ERROR;
848   } catch(...) {
849     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_text'"));
850     return SQ_ERROR;
851   }
852   
853 }
854
855 static int Text_set_font_wrapper(HSQUIRRELVM vm)
856 {
857   Scripting::Text* _this;
858   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
859     sq_throwerror(vm, _SC("'set_font' called without instance"));
860     return SQ_ERROR;
861   }
862   const char* arg0;
863   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
864     sq_throwerror(vm, _SC("Argument 1 not a string"));
865     return SQ_ERROR;
866   }
867   
868   try {
869     _this->set_font(arg0);
870   
871     return 0;
872   
873   } catch(std::exception& e) {
874     sq_throwerror(vm, e.what());
875     return SQ_ERROR;
876   } catch(...) {
877     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_font'"));
878     return SQ_ERROR;
879   }
880   
881 }
882
883 static int Text_fade_in_wrapper(HSQUIRRELVM vm)
884 {
885   Scripting::Text* _this;
886   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
887     sq_throwerror(vm, _SC("'fade_in' called without instance"));
888     return SQ_ERROR;
889   }
890   float arg0;
891   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
892     sq_throwerror(vm, _SC("Argument 1 not a float"));
893     return SQ_ERROR;
894   }
895   
896   try {
897     _this->fade_in(arg0);
898   
899     return 0;
900   
901   } catch(std::exception& e) {
902     sq_throwerror(vm, e.what());
903     return SQ_ERROR;
904   } catch(...) {
905     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
906     return SQ_ERROR;
907   }
908   
909 }
910
911 static int Text_fade_out_wrapper(HSQUIRRELVM vm)
912 {
913   Scripting::Text* _this;
914   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
915     sq_throwerror(vm, _SC("'fade_out' called without instance"));
916     return SQ_ERROR;
917   }
918   float arg0;
919   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
920     sq_throwerror(vm, _SC("Argument 1 not a float"));
921     return SQ_ERROR;
922   }
923   
924   try {
925     _this->fade_out(arg0);
926   
927     return 0;
928   
929   } catch(std::exception& e) {
930     sq_throwerror(vm, e.what());
931     return SQ_ERROR;
932   } catch(...) {
933     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
934     return SQ_ERROR;
935   }
936   
937 }
938
939 static int Text_set_visible_wrapper(HSQUIRRELVM vm)
940 {
941   Scripting::Text* _this;
942   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
943     sq_throwerror(vm, _SC("'set_visible' called without instance"));
944     return SQ_ERROR;
945   }
946   SQBool arg0;
947   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
948     sq_throwerror(vm, _SC("Argument 1 not a bool"));
949     return SQ_ERROR;
950   }
951   
952   try {
953     _this->set_visible(arg0);
954   
955     return 0;
956   
957   } catch(std::exception& e) {
958     sq_throwerror(vm, e.what());
959     return SQ_ERROR;
960   } catch(...) {
961     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
962     return SQ_ERROR;
963   }
964   
965 }
966
967 static int Text_set_centered_wrapper(HSQUIRRELVM vm)
968 {
969   Scripting::Text* _this;
970   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
971     sq_throwerror(vm, _SC("'set_centered' called without instance"));
972     return SQ_ERROR;
973   }
974   SQBool arg0;
975   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
976     sq_throwerror(vm, _SC("Argument 1 not a bool"));
977     return SQ_ERROR;
978   }
979   
980   try {
981     _this->set_centered(arg0);
982   
983     return 0;
984   
985   } catch(std::exception& e) {
986     sq_throwerror(vm, e.what());
987     return SQ_ERROR;
988   } catch(...) {
989     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_centered'"));
990     return SQ_ERROR;
991   }
992   
993 }
994
995 static int Player_release_hook(SQUserPointer ptr, int )
996 {
997   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
998   delete _this;
999   return 0;
1000 }
1001
1002 static int Player_set_bonus_wrapper(HSQUIRRELVM vm)
1003 {
1004   Scripting::Player* _this;
1005   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1006     sq_throwerror(vm, _SC("'set_bonus' called without instance"));
1007     return SQ_ERROR;
1008   }
1009   const char* arg0;
1010   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1011     sq_throwerror(vm, _SC("Argument 1 not a string"));
1012     return SQ_ERROR;
1013   }
1014   
1015   try {
1016     _this->set_bonus(arg0);
1017   
1018     return 0;
1019   
1020   } catch(std::exception& e) {
1021     sq_throwerror(vm, e.what());
1022     return SQ_ERROR;
1023   } catch(...) {
1024     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_bonus'"));
1025     return SQ_ERROR;
1026   }
1027   
1028 }
1029
1030 static int Player_add_coins_wrapper(HSQUIRRELVM vm)
1031 {
1032   Scripting::Player* _this;
1033   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1034     sq_throwerror(vm, _SC("'add_coins' called without instance"));
1035     return SQ_ERROR;
1036   }
1037   int arg0;
1038   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1039     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1040     return SQ_ERROR;
1041   }
1042   
1043   try {
1044     _this->add_coins(arg0);
1045   
1046     return 0;
1047   
1048   } catch(std::exception& e) {
1049     sq_throwerror(vm, e.what());
1050     return SQ_ERROR;
1051   } catch(...) {
1052     sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_coins'"));
1053     return SQ_ERROR;
1054   }
1055   
1056 }
1057
1058 static int Player_make_invincible_wrapper(HSQUIRRELVM vm)
1059 {
1060   Scripting::Player* _this;
1061   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1062     sq_throwerror(vm, _SC("'make_invincible' called without instance"));
1063     return SQ_ERROR;
1064   }
1065   
1066   try {
1067     _this->make_invincible();
1068   
1069     return 0;
1070   
1071   } catch(std::exception& e) {
1072     sq_throwerror(vm, e.what());
1073     return SQ_ERROR;
1074   } catch(...) {
1075     sq_throwerror(vm, _SC("Unexpected exception while executing function 'make_invincible'"));
1076     return SQ_ERROR;
1077   }
1078   
1079 }
1080
1081 static int Player_deactivate_wrapper(HSQUIRRELVM vm)
1082 {
1083   Scripting::Player* _this;
1084   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1085     sq_throwerror(vm, _SC("'deactivate' called without instance"));
1086     return SQ_ERROR;
1087   }
1088   
1089   try {
1090     _this->deactivate();
1091   
1092     return 0;
1093   
1094   } catch(std::exception& e) {
1095     sq_throwerror(vm, e.what());
1096     return SQ_ERROR;
1097   } catch(...) {
1098     sq_throwerror(vm, _SC("Unexpected exception while executing function 'deactivate'"));
1099     return SQ_ERROR;
1100   }
1101   
1102 }
1103
1104 static int Player_activate_wrapper(HSQUIRRELVM vm)
1105 {
1106   Scripting::Player* _this;
1107   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1108     sq_throwerror(vm, _SC("'activate' called without instance"));
1109     return SQ_ERROR;
1110   }
1111   
1112   try {
1113     _this->activate();
1114   
1115     return 0;
1116   
1117   } catch(std::exception& e) {
1118     sq_throwerror(vm, e.what());
1119     return SQ_ERROR;
1120   } catch(...) {
1121     sq_throwerror(vm, _SC("Unexpected exception while executing function 'activate'"));
1122     return SQ_ERROR;
1123   }
1124   
1125 }
1126
1127 static int Player_walk_wrapper(HSQUIRRELVM vm)
1128 {
1129   Scripting::Player* _this;
1130   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1131     sq_throwerror(vm, _SC("'walk' called without instance"));
1132     return SQ_ERROR;
1133   }
1134   float arg0;
1135   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1136     sq_throwerror(vm, _SC("Argument 1 not a float"));
1137     return SQ_ERROR;
1138   }
1139   
1140   try {
1141     _this->walk(arg0);
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 'walk'"));
1150     return SQ_ERROR;
1151   }
1152   
1153 }
1154
1155 static int Player_set_visible_wrapper(HSQUIRRELVM vm)
1156 {
1157   Scripting::Player* _this;
1158   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1159     sq_throwerror(vm, _SC("'set_visible' called without instance"));
1160     return SQ_ERROR;
1161   }
1162   SQBool arg0;
1163   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1164     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1165     return SQ_ERROR;
1166   }
1167   
1168   try {
1169     _this->set_visible(arg0);
1170   
1171     return 0;
1172   
1173   } catch(std::exception& e) {
1174     sq_throwerror(vm, e.what());
1175     return SQ_ERROR;
1176   } catch(...) {
1177     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1178     return SQ_ERROR;
1179   }
1180   
1181 }
1182
1183 static int Player_get_visible_wrapper(HSQUIRRELVM vm)
1184 {
1185   Scripting::Player* _this;
1186   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1187     sq_throwerror(vm, _SC("'get_visible' called without instance"));
1188     return SQ_ERROR;
1189   }
1190   
1191   try {
1192     bool return_value = _this->get_visible();
1193   
1194     sq_pushbool(vm, return_value);
1195     return 1;
1196   
1197   } catch(std::exception& e) {
1198     sq_throwerror(vm, e.what());
1199     return SQ_ERROR;
1200   } catch(...) {
1201     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1202     return SQ_ERROR;
1203   }
1204   
1205 }
1206
1207 static int FloatingImage_release_hook(SQUserPointer ptr, int )
1208 {
1209   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (ptr);
1210   delete _this;
1211   return 0;
1212 }
1213
1214 static int FloatingImage_constructor_wrapper(HSQUIRRELVM vm)
1215 {
1216   const char* arg0;
1217   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1218     sq_throwerror(vm, _SC("Argument 1 not a string"));
1219     return SQ_ERROR;
1220   }
1221   
1222   try {
1223     Scripting::FloatingImage* _this = new Scripting::FloatingImage(arg0);
1224   if(SQ_FAILED(sq_setinstanceup(vm, 1, _this))) {
1225     sq_throwerror(vm, _SC("Couldn't setup instance of 'FloatingImage' class"));
1226     return SQ_ERROR;
1227   }
1228   sq_setreleasehook(vm, 1, FloatingImage_release_hook);
1229   
1230     return 0;
1231   
1232   } catch(std::exception& e) {
1233     sq_throwerror(vm, e.what());
1234     return SQ_ERROR;
1235   } catch(...) {
1236     sq_throwerror(vm, _SC("Unexpected exception while executing function 'constructor'"));
1237     return SQ_ERROR;
1238   }
1239   
1240 }
1241
1242 static int FloatingImage_set_layer_wrapper(HSQUIRRELVM vm)
1243 {
1244   Scripting::FloatingImage* _this;
1245   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1246     sq_throwerror(vm, _SC("'set_layer' called without instance"));
1247     return SQ_ERROR;
1248   }
1249   int arg0;
1250   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1251     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1252     return SQ_ERROR;
1253   }
1254   
1255   try {
1256     _this->set_layer(arg0);
1257   
1258     return 0;
1259   
1260   } catch(std::exception& e) {
1261     sq_throwerror(vm, e.what());
1262     return SQ_ERROR;
1263   } catch(...) {
1264     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_layer'"));
1265     return SQ_ERROR;
1266   }
1267   
1268 }
1269
1270 static int FloatingImage_get_layer_wrapper(HSQUIRRELVM vm)
1271 {
1272   Scripting::FloatingImage* _this;
1273   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1274     sq_throwerror(vm, _SC("'get_layer' called without instance"));
1275     return SQ_ERROR;
1276   }
1277   
1278   try {
1279     int return_value = _this->get_layer();
1280   
1281     sq_pushinteger(vm, return_value);
1282     return 1;
1283   
1284   } catch(std::exception& e) {
1285     sq_throwerror(vm, e.what());
1286     return SQ_ERROR;
1287   } catch(...) {
1288     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_layer'"));
1289     return SQ_ERROR;
1290   }
1291   
1292 }
1293
1294 static int FloatingImage_set_pos_wrapper(HSQUIRRELVM vm)
1295 {
1296   Scripting::FloatingImage* _this;
1297   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1298     sq_throwerror(vm, _SC("'set_pos' called without instance"));
1299     return SQ_ERROR;
1300   }
1301   float arg0;
1302   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1303     sq_throwerror(vm, _SC("Argument 1 not a float"));
1304     return SQ_ERROR;
1305   }
1306   float arg1;
1307   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
1308     sq_throwerror(vm, _SC("Argument 2 not a float"));
1309     return SQ_ERROR;
1310   }
1311   
1312   try {
1313     _this->set_pos(arg0, arg1);
1314   
1315     return 0;
1316   
1317   } catch(std::exception& e) {
1318     sq_throwerror(vm, e.what());
1319     return SQ_ERROR;
1320   } catch(...) {
1321     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
1322     return SQ_ERROR;
1323   }
1324   
1325 }
1326
1327 static int FloatingImage_get_pos_x_wrapper(HSQUIRRELVM vm)
1328 {
1329   Scripting::FloatingImage* _this;
1330   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1331     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
1332     return SQ_ERROR;
1333   }
1334   
1335   try {
1336     float return_value = _this->get_pos_x();
1337   
1338     sq_pushfloat(vm, return_value);
1339     return 1;
1340   
1341   } catch(std::exception& e) {
1342     sq_throwerror(vm, e.what());
1343     return SQ_ERROR;
1344   } catch(...) {
1345     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
1346     return SQ_ERROR;
1347   }
1348   
1349 }
1350
1351 static int FloatingImage_get_pos_y_wrapper(HSQUIRRELVM vm)
1352 {
1353   Scripting::FloatingImage* _this;
1354   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1355     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
1356     return SQ_ERROR;
1357   }
1358   
1359   try {
1360     float return_value = _this->get_pos_y();
1361   
1362     sq_pushfloat(vm, return_value);
1363     return 1;
1364   
1365   } catch(std::exception& e) {
1366     sq_throwerror(vm, e.what());
1367     return SQ_ERROR;
1368   } catch(...) {
1369     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
1370     return SQ_ERROR;
1371   }
1372   
1373 }
1374
1375 static int FloatingImage_set_anchor_point_wrapper(HSQUIRRELVM vm)
1376 {
1377   Scripting::FloatingImage* _this;
1378   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1379     sq_throwerror(vm, _SC("'set_anchor_point' called without instance"));
1380     return SQ_ERROR;
1381   }
1382   int arg0;
1383   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1384     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1385     return SQ_ERROR;
1386   }
1387   
1388   try {
1389     _this->set_anchor_point(arg0);
1390   
1391     return 0;
1392   
1393   } catch(std::exception& e) {
1394     sq_throwerror(vm, e.what());
1395     return SQ_ERROR;
1396   } catch(...) {
1397     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_anchor_point'"));
1398     return SQ_ERROR;
1399   }
1400   
1401 }
1402
1403 static int FloatingImage_get_anchor_point_wrapper(HSQUIRRELVM vm)
1404 {
1405   Scripting::FloatingImage* _this;
1406   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1407     sq_throwerror(vm, _SC("'get_anchor_point' called without instance"));
1408     return SQ_ERROR;
1409   }
1410   
1411   try {
1412     int return_value = _this->get_anchor_point();
1413   
1414     sq_pushinteger(vm, return_value);
1415     return 1;
1416   
1417   } catch(std::exception& e) {
1418     sq_throwerror(vm, e.what());
1419     return SQ_ERROR;
1420   } catch(...) {
1421     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_anchor_point'"));
1422     return SQ_ERROR;
1423   }
1424   
1425 }
1426
1427 static int FloatingImage_set_visible_wrapper(HSQUIRRELVM vm)
1428 {
1429   Scripting::FloatingImage* _this;
1430   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1431     sq_throwerror(vm, _SC("'set_visible' called without instance"));
1432     return SQ_ERROR;
1433   }
1434   SQBool arg0;
1435   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1436     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1437     return SQ_ERROR;
1438   }
1439   
1440   try {
1441     _this->set_visible(arg0);
1442   
1443     return 0;
1444   
1445   } catch(std::exception& e) {
1446     sq_throwerror(vm, e.what());
1447     return SQ_ERROR;
1448   } catch(...) {
1449     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1450     return SQ_ERROR;
1451   }
1452   
1453 }
1454
1455 static int FloatingImage_get_visible_wrapper(HSQUIRRELVM vm)
1456 {
1457   Scripting::FloatingImage* _this;
1458   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1459     sq_throwerror(vm, _SC("'get_visible' called without instance"));
1460     return SQ_ERROR;
1461   }
1462   
1463   try {
1464     bool return_value = _this->get_visible();
1465   
1466     sq_pushbool(vm, return_value);
1467     return 1;
1468   
1469   } catch(std::exception& e) {
1470     sq_throwerror(vm, e.what());
1471     return SQ_ERROR;
1472   } catch(...) {
1473     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1474     return SQ_ERROR;
1475   }
1476   
1477 }
1478
1479 static int display_wrapper(HSQUIRRELVM vm)
1480 {
1481   return Scripting::display(vm);
1482 }
1483
1484 static int display_text_file_wrapper(HSQUIRRELVM vm)
1485 {
1486   const char* arg0;
1487   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1488     sq_throwerror(vm, _SC("Argument 1 not a string"));
1489     return SQ_ERROR;
1490   }
1491   
1492   try {
1493     Scripting::display_text_file(arg0);
1494   
1495     return 0;
1496   
1497   } catch(std::exception& e) {
1498     sq_throwerror(vm, e.what());
1499     return SQ_ERROR;
1500   } catch(...) {
1501     sq_throwerror(vm, _SC("Unexpected exception while executing function 'display_text_file'"));
1502     return SQ_ERROR;
1503   }
1504   
1505 }
1506
1507 static int load_worldmap_wrapper(HSQUIRRELVM vm)
1508 {
1509   const char* arg0;
1510   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1511     sq_throwerror(vm, _SC("Argument 1 not a string"));
1512     return SQ_ERROR;
1513   }
1514   
1515   try {
1516     Scripting::load_worldmap(arg0);
1517   
1518     return 0;
1519   
1520   } catch(std::exception& e) {
1521     sq_throwerror(vm, e.what());
1522     return SQ_ERROR;
1523   } catch(...) {
1524     sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_worldmap'"));
1525     return SQ_ERROR;
1526   }
1527   
1528 }
1529
1530 static int load_level_wrapper(HSQUIRRELVM vm)
1531 {
1532   const char* 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::load_level(arg0);
1540   
1541     return 0;
1542   
1543   } catch(std::exception& e) {
1544     sq_throwerror(vm, e.what());
1545     return SQ_ERROR;
1546   } catch(...) {
1547     sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_level'"));
1548     return SQ_ERROR;
1549   }
1550   
1551 }
1552
1553 static int wait_wrapper(HSQUIRRELVM vm)
1554 {
1555   HSQUIRRELVM arg0 = vm;
1556   float arg1;
1557   if(SQ_FAILED(sq_getfloat(vm, 2, &arg1))) {
1558     sq_throwerror(vm, _SC("Argument 1 not a float"));
1559     return SQ_ERROR;
1560   }
1561   
1562   try {
1563     Scripting::wait(arg0, arg1);
1564   
1565     return sq_suspendvm(vm);
1566   
1567   } catch(std::exception& e) {
1568     sq_throwerror(vm, e.what());
1569     return SQ_ERROR;
1570   } catch(...) {
1571     sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait'"));
1572     return SQ_ERROR;
1573   }
1574   
1575 }
1576
1577 static int wait_for_screenswitch_wrapper(HSQUIRRELVM vm)
1578 {
1579   HSQUIRRELVM arg0 = vm;
1580   
1581   try {
1582     Scripting::wait_for_screenswitch(arg0);
1583   
1584     return sq_suspendvm(vm);
1585   
1586   } catch(std::exception& e) {
1587     sq_throwerror(vm, e.what());
1588     return SQ_ERROR;
1589   } catch(...) {
1590     sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_screenswitch'"));
1591     return SQ_ERROR;
1592   }
1593   
1594 }
1595
1596 static int exit_screen_wrapper(HSQUIRRELVM vm)
1597 {
1598   (void) vm;
1599   
1600   try {
1601     Scripting::exit_screen();
1602   
1603     return 0;
1604   
1605   } catch(std::exception& e) {
1606     sq_throwerror(vm, e.what());
1607     return SQ_ERROR;
1608   } catch(...) {
1609     sq_throwerror(vm, _SC("Unexpected exception while executing function 'exit_screen'"));
1610     return SQ_ERROR;
1611   }
1612   
1613 }
1614
1615 static int translate_wrapper(HSQUIRRELVM vm)
1616 {
1617   const char* arg0;
1618   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1619     sq_throwerror(vm, _SC("Argument 1 not a string"));
1620     return SQ_ERROR;
1621   }
1622   
1623   try {
1624     std::string return_value = Scripting::translate(arg0);
1625   
1626     sq_pushstring(vm, return_value.c_str(), return_value.size());
1627     return 1;
1628   
1629   } catch(std::exception& e) {
1630     sq_throwerror(vm, e.what());
1631     return SQ_ERROR;
1632   } catch(...) {
1633     sq_throwerror(vm, _SC("Unexpected exception while executing function 'translate'"));
1634     return SQ_ERROR;
1635   }
1636   
1637 }
1638
1639 static int import_wrapper(HSQUIRRELVM vm)
1640 {
1641   HSQUIRRELVM arg0 = vm;
1642   const char* arg1;
1643   if(SQ_FAILED(sq_getstring(vm, 2, &arg1))) {
1644     sq_throwerror(vm, _SC("Argument 1 not a string"));
1645     return SQ_ERROR;
1646   }
1647   
1648   try {
1649     Scripting::import(arg0, arg1);
1650   
1651     return 0;
1652   
1653   } catch(std::exception& e) {
1654     sq_throwerror(vm, e.what());
1655     return SQ_ERROR;
1656   } catch(...) {
1657     sq_throwerror(vm, _SC("Unexpected exception while executing function 'import'"));
1658     return SQ_ERROR;
1659   }
1660   
1661 }
1662
1663 static int save_state_wrapper(HSQUIRRELVM vm)
1664 {
1665   (void) vm;
1666   
1667   try {
1668     Scripting::save_state();
1669   
1670     return 0;
1671   
1672   } catch(std::exception& e) {
1673     sq_throwerror(vm, e.what());
1674     return SQ_ERROR;
1675   } catch(...) {
1676     sq_throwerror(vm, _SC("Unexpected exception while executing function 'save_state'"));
1677     return SQ_ERROR;
1678   }
1679   
1680 }
1681
1682 static int add_key_wrapper(HSQUIRRELVM vm)
1683 {
1684   int arg0;
1685   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1686     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1687     return SQ_ERROR;
1688   }
1689   
1690   try {
1691     Scripting::add_key(arg0);
1692   
1693     return 0;
1694   
1695   } catch(std::exception& e) {
1696     sq_throwerror(vm, e.what());
1697     return SQ_ERROR;
1698   } catch(...) {
1699     sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_key'"));
1700     return SQ_ERROR;
1701   }
1702   
1703 }
1704
1705 static int debug_collrects_wrapper(HSQUIRRELVM vm)
1706 {
1707   SQBool arg0;
1708   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1709     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1710     return SQ_ERROR;
1711   }
1712   
1713   try {
1714     Scripting::debug_collrects(arg0);
1715   
1716     return 0;
1717   
1718   } catch(std::exception& e) {
1719     sq_throwerror(vm, e.what());
1720     return SQ_ERROR;
1721   } catch(...) {
1722     sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_collrects'"));
1723     return SQ_ERROR;
1724   }
1725   
1726 }
1727
1728 static int draw_solids_only_wrapper(HSQUIRRELVM vm)
1729 {
1730   SQBool arg0;
1731   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1732     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1733     return SQ_ERROR;
1734   }
1735   
1736   try {
1737     Scripting::draw_solids_only(arg0);
1738   
1739     return 0;
1740   
1741   } catch(std::exception& e) {
1742     sq_throwerror(vm, e.what());
1743     return SQ_ERROR;
1744   } catch(...) {
1745     sq_throwerror(vm, _SC("Unexpected exception while executing function 'draw_solids_only'"));
1746     return SQ_ERROR;
1747   }
1748   
1749 }
1750
1751 static int grease_wrapper(HSQUIRRELVM vm)
1752 {
1753   (void) vm;
1754   
1755   try {
1756     Scripting::grease();
1757   
1758     return 0;
1759   
1760   } catch(std::exception& e) {
1761     sq_throwerror(vm, e.what());
1762     return SQ_ERROR;
1763   } catch(...) {
1764     sq_throwerror(vm, _SC("Unexpected exception while executing function 'grease'"));
1765     return SQ_ERROR;
1766   }
1767   
1768 }
1769
1770 static int invincible_wrapper(HSQUIRRELVM vm)
1771 {
1772   (void) vm;
1773   
1774   try {
1775     Scripting::invincible();
1776   
1777     return 0;
1778   
1779   } catch(std::exception& e) {
1780     sq_throwerror(vm, e.what());
1781     return SQ_ERROR;
1782   } catch(...) {
1783     sq_throwerror(vm, _SC("Unexpected exception while executing function 'invincible'"));
1784     return SQ_ERROR;
1785   }
1786   
1787 }
1788
1789 static int mortal_wrapper(HSQUIRRELVM vm)
1790 {
1791   (void) vm;
1792   
1793   try {
1794     Scripting::mortal();
1795   
1796     return 0;
1797   
1798   } catch(std::exception& e) {
1799     sq_throwerror(vm, e.what());
1800     return SQ_ERROR;
1801   } catch(...) {
1802     sq_throwerror(vm, _SC("Unexpected exception while executing function 'mortal'"));
1803     return SQ_ERROR;
1804   }
1805   
1806 }
1807
1808 static int shrink_wrapper(HSQUIRRELVM vm)
1809 {
1810   (void) vm;
1811   
1812   try {
1813     Scripting::shrink();
1814   
1815     return 0;
1816   
1817   } catch(std::exception& e) {
1818     sq_throwerror(vm, e.what());
1819     return SQ_ERROR;
1820   } catch(...) {
1821     sq_throwerror(vm, _SC("Unexpected exception while executing function 'shrink'"));
1822     return SQ_ERROR;
1823   }
1824   
1825 }
1826
1827 static int kill_wrapper(HSQUIRRELVM vm)
1828 {
1829   (void) vm;
1830   
1831   try {
1832     Scripting::kill();
1833   
1834     return 0;
1835   
1836   } catch(std::exception& e) {
1837     sq_throwerror(vm, e.what());
1838     return SQ_ERROR;
1839   } catch(...) {
1840     sq_throwerror(vm, _SC("Unexpected exception while executing function 'kill'"));
1841     return SQ_ERROR;
1842   }
1843   
1844 }
1845
1846 static int restart_wrapper(HSQUIRRELVM vm)
1847 {
1848   (void) vm;
1849   
1850   try {
1851     Scripting::restart();
1852   
1853     return 0;
1854   
1855   } catch(std::exception& e) {
1856     sq_throwerror(vm, e.what());
1857     return SQ_ERROR;
1858   } catch(...) {
1859     sq_throwerror(vm, _SC("Unexpected exception while executing function 'restart'"));
1860     return SQ_ERROR;
1861   }
1862   
1863 }
1864
1865 static int whereami_wrapper(HSQUIRRELVM vm)
1866 {
1867   (void) vm;
1868   
1869   try {
1870     Scripting::whereami();
1871   
1872     return 0;
1873   
1874   } catch(std::exception& e) {
1875     sq_throwerror(vm, e.what());
1876     return SQ_ERROR;
1877   } catch(...) {
1878     sq_throwerror(vm, _SC("Unexpected exception while executing function 'whereami'"));
1879     return SQ_ERROR;
1880   }
1881   
1882 }
1883
1884 static int gotoend_wrapper(HSQUIRRELVM vm)
1885 {
1886   (void) vm;
1887   
1888   try {
1889     Scripting::gotoend();
1890   
1891     return 0;
1892   
1893   } catch(std::exception& e) {
1894     sq_throwerror(vm, e.what());
1895     return SQ_ERROR;
1896   } catch(...) {
1897     sq_throwerror(vm, _SC("Unexpected exception while executing function 'gotoend'"));
1898     return SQ_ERROR;
1899   }
1900   
1901 }
1902
1903 static int flip_wrapper(HSQUIRRELVM vm)
1904 {
1905   (void) vm;
1906   
1907   try {
1908     Scripting::flip();
1909   
1910     return 0;
1911   
1912   } catch(std::exception& e) {
1913     sq_throwerror(vm, e.what());
1914     return SQ_ERROR;
1915   } catch(...) {
1916     sq_throwerror(vm, _SC("Unexpected exception while executing function 'flip'"));
1917     return SQ_ERROR;
1918   }
1919   
1920 }
1921
1922 static int finish_wrapper(HSQUIRRELVM vm)
1923 {
1924   (void) vm;
1925   
1926   try {
1927     Scripting::finish();
1928   
1929     return 0;
1930   
1931   } catch(std::exception& e) {
1932     sq_throwerror(vm, e.what());
1933     return SQ_ERROR;
1934   } catch(...) {
1935     sq_throwerror(vm, _SC("Unexpected exception while executing function 'finish'"));
1936     return SQ_ERROR;
1937   }
1938   
1939 }
1940
1941 static int camera_wrapper(HSQUIRRELVM vm)
1942 {
1943   (void) vm;
1944   
1945   try {
1946     Scripting::camera();
1947   
1948     return 0;
1949   
1950   } catch(std::exception& e) {
1951     sq_throwerror(vm, e.what());
1952     return SQ_ERROR;
1953   } catch(...) {
1954     sq_throwerror(vm, _SC("Unexpected exception while executing function 'camera'"));
1955     return SQ_ERROR;
1956   }
1957   
1958 }
1959
1960 static int quit_wrapper(HSQUIRRELVM vm)
1961 {
1962   (void) vm;
1963   
1964   try {
1965     Scripting::quit();
1966   
1967     return 0;
1968   
1969   } catch(std::exception& e) {
1970     sq_throwerror(vm, e.what());
1971     return SQ_ERROR;
1972   } catch(...) {
1973     sq_throwerror(vm, _SC("Unexpected exception while executing function 'quit'"));
1974     return SQ_ERROR;
1975   }
1976   
1977 }
1978
1979 } // end of namespace Wrapper
1980
1981 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
1982 {
1983   using namespace Wrapper;
1984
1985   sq_pushroottable(v);
1986   sq_pushstring(v, "DisplayEffect", -1);
1987   if(SQ_FAILED(sq_get(v, -2))) {
1988     std::ostringstream msg;
1989     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
1990     throw SquirrelError(v, msg.str());
1991   }
1992
1993   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1994     std::ostringstream msg;
1995     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
1996     throw SquirrelError(v, msg.str());
1997   }
1998   sq_remove(v, -2); // remove object name
1999
2000   if(setup_releasehook) {
2001     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
2002   }
2003
2004   sq_remove(v, -2); // remove root table
2005 }
2006
2007 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
2008 {
2009   using namespace Wrapper;
2010
2011   sq_pushroottable(v);
2012   sq_pushstring(v, "Camera", -1);
2013   if(SQ_FAILED(sq_get(v, -2))) {
2014     std::ostringstream msg;
2015     msg << "Couldn't resolved squirrel type 'Camera'";
2016     throw SquirrelError(v, msg.str());
2017   }
2018
2019   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2020     std::ostringstream msg;
2021     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
2022     throw SquirrelError(v, msg.str());
2023   }
2024   sq_remove(v, -2); // remove object name
2025
2026   if(setup_releasehook) {
2027     sq_setreleasehook(v, -1, Camera_release_hook);
2028   }
2029
2030   sq_remove(v, -2); // remove root table
2031 }
2032
2033 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
2034 {
2035   using namespace Wrapper;
2036
2037   sq_pushroottable(v);
2038   sq_pushstring(v, "Level", -1);
2039   if(SQ_FAILED(sq_get(v, -2))) {
2040     std::ostringstream msg;
2041     msg << "Couldn't resolved squirrel type 'Level'";
2042     throw SquirrelError(v, msg.str());
2043   }
2044
2045   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2046     std::ostringstream msg;
2047     msg << "Couldn't setup squirrel instance for object of type 'Level'";
2048     throw SquirrelError(v, msg.str());
2049   }
2050   sq_remove(v, -2); // remove object name
2051
2052   if(setup_releasehook) {
2053     sq_setreleasehook(v, -1, Level_release_hook);
2054   }
2055
2056   sq_remove(v, -2); // remove root table
2057 }
2058
2059 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
2060 {
2061   using namespace Wrapper;
2062
2063   sq_pushroottable(v);
2064   sq_pushstring(v, "ScriptedObject", -1);
2065   if(SQ_FAILED(sq_get(v, -2))) {
2066     std::ostringstream msg;
2067     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
2068     throw SquirrelError(v, msg.str());
2069   }
2070
2071   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2072     std::ostringstream msg;
2073     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
2074     throw SquirrelError(v, msg.str());
2075   }
2076   sq_remove(v, -2); // remove object name
2077
2078   if(setup_releasehook) {
2079     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
2080   }
2081
2082   sq_remove(v, -2); // remove root table
2083 }
2084
2085 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
2086 {
2087   using namespace Wrapper;
2088
2089   sq_pushroottable(v);
2090   sq_pushstring(v, "Sound", -1);
2091   if(SQ_FAILED(sq_get(v, -2))) {
2092     std::ostringstream msg;
2093     msg << "Couldn't resolved squirrel type 'Sound'";
2094     throw SquirrelError(v, msg.str());
2095   }
2096
2097   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2098     std::ostringstream msg;
2099     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
2100     throw SquirrelError(v, msg.str());
2101   }
2102   sq_remove(v, -2); // remove object name
2103
2104   if(setup_releasehook) {
2105     sq_setreleasehook(v, -1, Sound_release_hook);
2106   }
2107
2108   sq_remove(v, -2); // remove root table
2109 }
2110
2111 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
2112 {
2113   using namespace Wrapper;
2114
2115   sq_pushroottable(v);
2116   sq_pushstring(v, "Text", -1);
2117   if(SQ_FAILED(sq_get(v, -2))) {
2118     std::ostringstream msg;
2119     msg << "Couldn't resolved squirrel type 'Text'";
2120     throw SquirrelError(v, msg.str());
2121   }
2122
2123   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2124     std::ostringstream msg;
2125     msg << "Couldn't setup squirrel instance for object of type 'Text'";
2126     throw SquirrelError(v, msg.str());
2127   }
2128   sq_remove(v, -2); // remove object name
2129
2130   if(setup_releasehook) {
2131     sq_setreleasehook(v, -1, Text_release_hook);
2132   }
2133
2134   sq_remove(v, -2); // remove root table
2135 }
2136
2137 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
2138 {
2139   using namespace Wrapper;
2140
2141   sq_pushroottable(v);
2142   sq_pushstring(v, "Player", -1);
2143   if(SQ_FAILED(sq_get(v, -2))) {
2144     std::ostringstream msg;
2145     msg << "Couldn't resolved squirrel type 'Player'";
2146     throw SquirrelError(v, msg.str());
2147   }
2148
2149   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2150     std::ostringstream msg;
2151     msg << "Couldn't setup squirrel instance for object of type 'Player'";
2152     throw SquirrelError(v, msg.str());
2153   }
2154   sq_remove(v, -2); // remove object name
2155
2156   if(setup_releasehook) {
2157     sq_setreleasehook(v, -1, Player_release_hook);
2158   }
2159
2160   sq_remove(v, -2); // remove root table
2161 }
2162
2163 void create_squirrel_instance(HSQUIRRELVM v, Scripting::FloatingImage* object, bool setup_releasehook)
2164 {
2165   using namespace Wrapper;
2166
2167   sq_pushroottable(v);
2168   sq_pushstring(v, "FloatingImage", -1);
2169   if(SQ_FAILED(sq_get(v, -2))) {
2170     std::ostringstream msg;
2171     msg << "Couldn't resolved squirrel type 'FloatingImage'";
2172     throw SquirrelError(v, msg.str());
2173   }
2174
2175   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2176     std::ostringstream msg;
2177     msg << "Couldn't setup squirrel instance for object of type 'FloatingImage'";
2178     throw SquirrelError(v, msg.str());
2179   }
2180   sq_remove(v, -2); // remove object name
2181
2182   if(setup_releasehook) {
2183     sq_setreleasehook(v, -1, FloatingImage_release_hook);
2184   }
2185
2186   sq_remove(v, -2); // remove root table
2187 }
2188
2189 void register_supertux_wrapper(HSQUIRRELVM v)
2190 {
2191   using namespace Wrapper;
2192
2193   sq_pushstring(v, "KEY_BRASS", -1);
2194   sq_pushinteger(v, 1);
2195   if(SQ_FAILED(sq_createslot(v, -3))) {
2196     throw SquirrelError(v, "Couldn't register constant 'KEY_BRASS'");
2197   }
2198
2199   sq_pushstring(v, "KEY_IRON", -1);
2200   sq_pushinteger(v, 2);
2201   if(SQ_FAILED(sq_createslot(v, -3))) {
2202     throw SquirrelError(v, "Couldn't register constant 'KEY_IRON'");
2203   }
2204
2205   sq_pushstring(v, "KEY_BRONZE", -1);
2206   sq_pushinteger(v, 4);
2207   if(SQ_FAILED(sq_createslot(v, -3))) {
2208     throw SquirrelError(v, "Couldn't register constant 'KEY_BRONZE'");
2209   }
2210
2211   sq_pushstring(v, "KEY_SILVER", -1);
2212   sq_pushinteger(v, 8);
2213   if(SQ_FAILED(sq_createslot(v, -3))) {
2214     throw SquirrelError(v, "Couldn't register constant 'KEY_SILVER'");
2215   }
2216
2217   sq_pushstring(v, "KEY_GOLD", -1);
2218   sq_pushinteger(v, 16);
2219   if(SQ_FAILED(sq_createslot(v, -3))) {
2220     throw SquirrelError(v, "Couldn't register constant 'KEY_GOLD'");
2221   }
2222
2223   sq_pushstring(v, "ANCHOR_TOP", -1);
2224   sq_pushinteger(v, 16);
2225   if(SQ_FAILED(sq_createslot(v, -3))) {
2226     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP'");
2227   }
2228
2229   sq_pushstring(v, "ANCHOR_BOTTOM", -1);
2230   sq_pushinteger(v, 32);
2231   if(SQ_FAILED(sq_createslot(v, -3))) {
2232     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM'");
2233   }
2234
2235   sq_pushstring(v, "ANCHOR_LEFT", -1);
2236   sq_pushinteger(v, 1);
2237   if(SQ_FAILED(sq_createslot(v, -3))) {
2238     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_LEFT'");
2239   }
2240
2241   sq_pushstring(v, "ANCHOR_RIGHT", -1);
2242   sq_pushinteger(v, 2);
2243   if(SQ_FAILED(sq_createslot(v, -3))) {
2244     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_RIGHT'");
2245   }
2246
2247   sq_pushstring(v, "ANCHOR_MIDDLE", -1);
2248   sq_pushinteger(v, 0);
2249   if(SQ_FAILED(sq_createslot(v, -3))) {
2250     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_MIDDLE'");
2251   }
2252
2253   sq_pushstring(v, "ANCHOR_TOP_LEFT", -1);
2254   sq_pushinteger(v, 17);
2255   if(SQ_FAILED(sq_createslot(v, -3))) {
2256     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_LEFT'");
2257   }
2258
2259   sq_pushstring(v, "ANCHOR_TOP_RIGHT", -1);
2260   sq_pushinteger(v, 18);
2261   if(SQ_FAILED(sq_createslot(v, -3))) {
2262     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_RIGHT'");
2263   }
2264
2265   sq_pushstring(v, "ANCHOR_BOTTOM_LEFT", -1);
2266   sq_pushinteger(v, 33);
2267   if(SQ_FAILED(sq_createslot(v, -3))) {
2268     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_LEFT'");
2269   }
2270
2271   sq_pushstring(v, "ANCHOR_BOTTOM_RIGHT", -1);
2272   sq_pushinteger(v, 34);
2273   if(SQ_FAILED(sq_createslot(v, -3))) {
2274     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_RIGHT'");
2275   }
2276
2277   sq_pushstring(v, "display", -1);
2278   sq_newclosure(v, &display_wrapper, 0);
2279   if(SQ_FAILED(sq_createslot(v, -3))) {
2280     throw SquirrelError(v, "Couldn't register function 'display'");
2281   }
2282
2283   sq_pushstring(v, "display_text_file", -1);
2284   sq_newclosure(v, &display_text_file_wrapper, 0);
2285   if(SQ_FAILED(sq_createslot(v, -3))) {
2286     throw SquirrelError(v, "Couldn't register function 'display_text_file'");
2287   }
2288
2289   sq_pushstring(v, "load_worldmap", -1);
2290   sq_newclosure(v, &load_worldmap_wrapper, 0);
2291   if(SQ_FAILED(sq_createslot(v, -3))) {
2292     throw SquirrelError(v, "Couldn't register function 'load_worldmap'");
2293   }
2294
2295   sq_pushstring(v, "load_level", -1);
2296   sq_newclosure(v, &load_level_wrapper, 0);
2297   if(SQ_FAILED(sq_createslot(v, -3))) {
2298     throw SquirrelError(v, "Couldn't register function 'load_level'");
2299   }
2300
2301   sq_pushstring(v, "wait", -1);
2302   sq_newclosure(v, &wait_wrapper, 0);
2303   if(SQ_FAILED(sq_createslot(v, -3))) {
2304     throw SquirrelError(v, "Couldn't register function 'wait'");
2305   }
2306
2307   sq_pushstring(v, "wait_for_screenswitch", -1);
2308   sq_newclosure(v, &wait_for_screenswitch_wrapper, 0);
2309   if(SQ_FAILED(sq_createslot(v, -3))) {
2310     throw SquirrelError(v, "Couldn't register function 'wait_for_screenswitch'");
2311   }
2312
2313   sq_pushstring(v, "exit_screen", -1);
2314   sq_newclosure(v, &exit_screen_wrapper, 0);
2315   if(SQ_FAILED(sq_createslot(v, -3))) {
2316     throw SquirrelError(v, "Couldn't register function 'exit_screen'");
2317   }
2318
2319   sq_pushstring(v, "translate", -1);
2320   sq_newclosure(v, &translate_wrapper, 0);
2321   if(SQ_FAILED(sq_createslot(v, -3))) {
2322     throw SquirrelError(v, "Couldn't register function 'translate'");
2323   }
2324
2325   sq_pushstring(v, "import", -1);
2326   sq_newclosure(v, &import_wrapper, 0);
2327   if(SQ_FAILED(sq_createslot(v, -3))) {
2328     throw SquirrelError(v, "Couldn't register function 'import'");
2329   }
2330
2331   sq_pushstring(v, "save_state", -1);
2332   sq_newclosure(v, &save_state_wrapper, 0);
2333   if(SQ_FAILED(sq_createslot(v, -3))) {
2334     throw SquirrelError(v, "Couldn't register function 'save_state'");
2335   }
2336
2337   sq_pushstring(v, "add_key", -1);
2338   sq_newclosure(v, &add_key_wrapper, 0);
2339   if(SQ_FAILED(sq_createslot(v, -3))) {
2340     throw SquirrelError(v, "Couldn't register function 'add_key'");
2341   }
2342
2343   sq_pushstring(v, "debug_collrects", -1);
2344   sq_newclosure(v, &debug_collrects_wrapper, 0);
2345   if(SQ_FAILED(sq_createslot(v, -3))) {
2346     throw SquirrelError(v, "Couldn't register function 'debug_collrects'");
2347   }
2348
2349   sq_pushstring(v, "draw_solids_only", -1);
2350   sq_newclosure(v, &draw_solids_only_wrapper, 0);
2351   if(SQ_FAILED(sq_createslot(v, -3))) {
2352     throw SquirrelError(v, "Couldn't register function 'draw_solids_only'");
2353   }
2354
2355   sq_pushstring(v, "grease", -1);
2356   sq_newclosure(v, &grease_wrapper, 0);
2357   if(SQ_FAILED(sq_createslot(v, -3))) {
2358     throw SquirrelError(v, "Couldn't register function 'grease'");
2359   }
2360
2361   sq_pushstring(v, "invincible", -1);
2362   sq_newclosure(v, &invincible_wrapper, 0);
2363   if(SQ_FAILED(sq_createslot(v, -3))) {
2364     throw SquirrelError(v, "Couldn't register function 'invincible'");
2365   }
2366
2367   sq_pushstring(v, "mortal", -1);
2368   sq_newclosure(v, &mortal_wrapper, 0);
2369   if(SQ_FAILED(sq_createslot(v, -3))) {
2370     throw SquirrelError(v, "Couldn't register function 'mortal'");
2371   }
2372
2373   sq_pushstring(v, "shrink", -1);
2374   sq_newclosure(v, &shrink_wrapper, 0);
2375   if(SQ_FAILED(sq_createslot(v, -3))) {
2376     throw SquirrelError(v, "Couldn't register function 'shrink'");
2377   }
2378
2379   sq_pushstring(v, "kill", -1);
2380   sq_newclosure(v, &kill_wrapper, 0);
2381   if(SQ_FAILED(sq_createslot(v, -3))) {
2382     throw SquirrelError(v, "Couldn't register function 'kill'");
2383   }
2384
2385   sq_pushstring(v, "restart", -1);
2386   sq_newclosure(v, &restart_wrapper, 0);
2387   if(SQ_FAILED(sq_createslot(v, -3))) {
2388     throw SquirrelError(v, "Couldn't register function 'restart'");
2389   }
2390
2391   sq_pushstring(v, "whereami", -1);
2392   sq_newclosure(v, &whereami_wrapper, 0);
2393   if(SQ_FAILED(sq_createslot(v, -3))) {
2394     throw SquirrelError(v, "Couldn't register function 'whereami'");
2395   }
2396
2397   sq_pushstring(v, "gotoend", -1);
2398   sq_newclosure(v, &gotoend_wrapper, 0);
2399   if(SQ_FAILED(sq_createslot(v, -3))) {
2400     throw SquirrelError(v, "Couldn't register function 'gotoend'");
2401   }
2402
2403   sq_pushstring(v, "flip", -1);
2404   sq_newclosure(v, &flip_wrapper, 0);
2405   if(SQ_FAILED(sq_createslot(v, -3))) {
2406     throw SquirrelError(v, "Couldn't register function 'flip'");
2407   }
2408
2409   sq_pushstring(v, "finish", -1);
2410   sq_newclosure(v, &finish_wrapper, 0);
2411   if(SQ_FAILED(sq_createslot(v, -3))) {
2412     throw SquirrelError(v, "Couldn't register function 'finish'");
2413   }
2414
2415   sq_pushstring(v, "camera", -1);
2416   sq_newclosure(v, &camera_wrapper, 0);
2417   if(SQ_FAILED(sq_createslot(v, -3))) {
2418     throw SquirrelError(v, "Couldn't register function 'camera'");
2419   }
2420
2421   sq_pushstring(v, "quit", -1);
2422   sq_newclosure(v, &quit_wrapper, 0);
2423   if(SQ_FAILED(sq_createslot(v, -3))) {
2424     throw SquirrelError(v, "Couldn't register function 'quit'");
2425   }
2426
2427   // Register class DisplayEffect
2428   sq_pushstring(v, "DisplayEffect", -1);
2429   if(sq_newclass(v, SQFalse) < 0) {
2430     std::ostringstream msg;
2431     msg << "Couldn't create new class 'DisplayEffect'";
2432     throw SquirrelError(v, msg.str());
2433   }
2434   sq_pushstring(v, "fade_out", -1);
2435   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
2436   if(SQ_FAILED(sq_createslot(v, -3))) {
2437     throw SquirrelError(v, "Couldn't register function 'fade_out'");
2438   }
2439
2440   sq_pushstring(v, "fade_in", -1);
2441   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
2442   if(SQ_FAILED(sq_createslot(v, -3))) {
2443     throw SquirrelError(v, "Couldn't register function 'fade_in'");
2444   }
2445
2446   sq_pushstring(v, "set_black", -1);
2447   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
2448   if(SQ_FAILED(sq_createslot(v, -3))) {
2449     throw SquirrelError(v, "Couldn't register function 'set_black'");
2450   }
2451
2452   sq_pushstring(v, "is_black", -1);
2453   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
2454   if(SQ_FAILED(sq_createslot(v, -3))) {
2455     throw SquirrelError(v, "Couldn't register function 'is_black'");
2456   }
2457
2458   sq_pushstring(v, "sixteen_to_nine", -1);
2459   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
2460   if(SQ_FAILED(sq_createslot(v, -3))) {
2461     throw SquirrelError(v, "Couldn't register function 'sixteen_to_nine'");
2462   }
2463
2464   sq_pushstring(v, "four_to_three", -1);
2465   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
2466   if(SQ_FAILED(sq_createslot(v, -3))) {
2467     throw SquirrelError(v, "Couldn't register function 'four_to_three'");
2468   }
2469
2470   if(SQ_FAILED(sq_createslot(v, -3))) {
2471     throw SquirrelError(v, "Couldn't register class 'DisplayEffect'");
2472   }
2473
2474   // Register class Camera
2475   sq_pushstring(v, "Camera", -1);
2476   if(sq_newclass(v, SQFalse) < 0) {
2477     std::ostringstream msg;
2478     msg << "Couldn't create new class 'Camera'";
2479     throw SquirrelError(v, msg.str());
2480   }
2481   sq_pushstring(v, "shake", -1);
2482   sq_newclosure(v, &Camera_shake_wrapper, 0);
2483   if(SQ_FAILED(sq_createslot(v, -3))) {
2484     throw SquirrelError(v, "Couldn't register function 'shake'");
2485   }
2486
2487   sq_pushstring(v, "set_pos", -1);
2488   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
2489   if(SQ_FAILED(sq_createslot(v, -3))) {
2490     throw SquirrelError(v, "Couldn't register function 'set_pos'");
2491   }
2492
2493   sq_pushstring(v, "set_mode", -1);
2494   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
2495   if(SQ_FAILED(sq_createslot(v, -3))) {
2496     throw SquirrelError(v, "Couldn't register function 'set_mode'");
2497   }
2498
2499   sq_pushstring(v, "scroll_to", -1);
2500   sq_newclosure(v, &Camera_scroll_to_wrapper, 0);
2501   if(SQ_FAILED(sq_createslot(v, -3))) {
2502     throw SquirrelError(v, "Couldn't register function 'scroll_to'");
2503   }
2504
2505   if(SQ_FAILED(sq_createslot(v, -3))) {
2506     throw SquirrelError(v, "Couldn't register class 'Camera'");
2507   }
2508
2509   // Register class Level
2510   sq_pushstring(v, "Level", -1);
2511   if(sq_newclass(v, SQFalse) < 0) {
2512     std::ostringstream msg;
2513     msg << "Couldn't create new class 'Level'";
2514     throw SquirrelError(v, msg.str());
2515   }
2516   sq_pushstring(v, "finish", -1);
2517   sq_newclosure(v, &Level_finish_wrapper, 0);
2518   if(SQ_FAILED(sq_createslot(v, -3))) {
2519     throw SquirrelError(v, "Couldn't register function 'finish'");
2520   }
2521
2522   sq_pushstring(v, "spawn", -1);
2523   sq_newclosure(v, &Level_spawn_wrapper, 0);
2524   if(SQ_FAILED(sq_createslot(v, -3))) {
2525     throw SquirrelError(v, "Couldn't register function 'spawn'");
2526   }
2527
2528   sq_pushstring(v, "flip_vertically", -1);
2529   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
2530   if(SQ_FAILED(sq_createslot(v, -3))) {
2531     throw SquirrelError(v, "Couldn't register function 'flip_vertically'");
2532   }
2533
2534   if(SQ_FAILED(sq_createslot(v, -3))) {
2535     throw SquirrelError(v, "Couldn't register class 'Level'");
2536   }
2537
2538   // Register class ScriptedObject
2539   sq_pushstring(v, "ScriptedObject", -1);
2540   if(sq_newclass(v, SQFalse) < 0) {
2541     std::ostringstream msg;
2542     msg << "Couldn't create new class 'ScriptedObject'";
2543     throw SquirrelError(v, msg.str());
2544   }
2545   sq_pushstring(v, "set_action", -1);
2546   sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0);
2547   if(SQ_FAILED(sq_createslot(v, -3))) {
2548     throw SquirrelError(v, "Couldn't register function 'set_action'");
2549   }
2550
2551   sq_pushstring(v, "get_action", -1);
2552   sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0);
2553   if(SQ_FAILED(sq_createslot(v, -3))) {
2554     throw SquirrelError(v, "Couldn't register function 'get_action'");
2555   }
2556
2557   sq_pushstring(v, "move", -1);
2558   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
2559   if(SQ_FAILED(sq_createslot(v, -3))) {
2560     throw SquirrelError(v, "Couldn't register function 'move'");
2561   }
2562
2563   sq_pushstring(v, "set_pos", -1);
2564   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
2565   if(SQ_FAILED(sq_createslot(v, -3))) {
2566     throw SquirrelError(v, "Couldn't register function 'set_pos'");
2567   }
2568
2569   sq_pushstring(v, "get_pos_x", -1);
2570   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
2571   if(SQ_FAILED(sq_createslot(v, -3))) {
2572     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
2573   }
2574
2575   sq_pushstring(v, "get_pos_y", -1);
2576   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
2577   if(SQ_FAILED(sq_createslot(v, -3))) {
2578     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
2579   }
2580
2581   sq_pushstring(v, "set_velocity", -1);
2582   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
2583   if(SQ_FAILED(sq_createslot(v, -3))) {
2584     throw SquirrelError(v, "Couldn't register function 'set_velocity'");
2585   }
2586
2587   sq_pushstring(v, "get_velocity_x", -1);
2588   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
2589   if(SQ_FAILED(sq_createslot(v, -3))) {
2590     throw SquirrelError(v, "Couldn't register function 'get_velocity_x'");
2591   }
2592
2593   sq_pushstring(v, "get_velocity_y", -1);
2594   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
2595   if(SQ_FAILED(sq_createslot(v, -3))) {
2596     throw SquirrelError(v, "Couldn't register function 'get_velocity_y'");
2597   }
2598
2599   sq_pushstring(v, "set_visible", -1);
2600   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
2601   if(SQ_FAILED(sq_createslot(v, -3))) {
2602     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2603   }
2604
2605   sq_pushstring(v, "is_visible", -1);
2606   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
2607   if(SQ_FAILED(sq_createslot(v, -3))) {
2608     throw SquirrelError(v, "Couldn't register function 'is_visible'");
2609   }
2610
2611   sq_pushstring(v, "get_name", -1);
2612   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
2613   if(SQ_FAILED(sq_createslot(v, -3))) {
2614     throw SquirrelError(v, "Couldn't register function 'get_name'");
2615   }
2616
2617   if(SQ_FAILED(sq_createslot(v, -3))) {
2618     throw SquirrelError(v, "Couldn't register class 'ScriptedObject'");
2619   }
2620
2621   // Register class Sound
2622   sq_pushstring(v, "Sound", -1);
2623   if(sq_newclass(v, SQFalse) < 0) {
2624     std::ostringstream msg;
2625     msg << "Couldn't create new class 'Sound'";
2626     throw SquirrelError(v, msg.str());
2627   }
2628   sq_pushstring(v, "play_music", -1);
2629   sq_newclosure(v, &Sound_play_music_wrapper, 0);
2630   if(SQ_FAILED(sq_createslot(v, -3))) {
2631     throw SquirrelError(v, "Couldn't register function 'play_music'");
2632   }
2633
2634   sq_pushstring(v, "play", -1);
2635   sq_newclosure(v, &Sound_play_wrapper, 0);
2636   if(SQ_FAILED(sq_createslot(v, -3))) {
2637     throw SquirrelError(v, "Couldn't register function 'play'");
2638   }
2639
2640   if(SQ_FAILED(sq_createslot(v, -3))) {
2641     throw SquirrelError(v, "Couldn't register class 'Sound'");
2642   }
2643
2644   // Register class Text
2645   sq_pushstring(v, "Text", -1);
2646   if(sq_newclass(v, SQFalse) < 0) {
2647     std::ostringstream msg;
2648     msg << "Couldn't create new class 'Text'";
2649     throw SquirrelError(v, msg.str());
2650   }
2651   sq_pushstring(v, "set_text", -1);
2652   sq_newclosure(v, &Text_set_text_wrapper, 0);
2653   if(SQ_FAILED(sq_createslot(v, -3))) {
2654     throw SquirrelError(v, "Couldn't register function 'set_text'");
2655   }
2656
2657   sq_pushstring(v, "set_font", -1);
2658   sq_newclosure(v, &Text_set_font_wrapper, 0);
2659   if(SQ_FAILED(sq_createslot(v, -3))) {
2660     throw SquirrelError(v, "Couldn't register function 'set_font'");
2661   }
2662
2663   sq_pushstring(v, "fade_in", -1);
2664   sq_newclosure(v, &Text_fade_in_wrapper, 0);
2665   if(SQ_FAILED(sq_createslot(v, -3))) {
2666     throw SquirrelError(v, "Couldn't register function 'fade_in'");
2667   }
2668
2669   sq_pushstring(v, "fade_out", -1);
2670   sq_newclosure(v, &Text_fade_out_wrapper, 0);
2671   if(SQ_FAILED(sq_createslot(v, -3))) {
2672     throw SquirrelError(v, "Couldn't register function 'fade_out'");
2673   }
2674
2675   sq_pushstring(v, "set_visible", -1);
2676   sq_newclosure(v, &Text_set_visible_wrapper, 0);
2677   if(SQ_FAILED(sq_createslot(v, -3))) {
2678     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2679   }
2680
2681   sq_pushstring(v, "set_centered", -1);
2682   sq_newclosure(v, &Text_set_centered_wrapper, 0);
2683   if(SQ_FAILED(sq_createslot(v, -3))) {
2684     throw SquirrelError(v, "Couldn't register function 'set_centered'");
2685   }
2686
2687   if(SQ_FAILED(sq_createslot(v, -3))) {
2688     throw SquirrelError(v, "Couldn't register class 'Text'");
2689   }
2690
2691   // Register class Player
2692   sq_pushstring(v, "Player", -1);
2693   if(sq_newclass(v, SQFalse) < 0) {
2694     std::ostringstream msg;
2695     msg << "Couldn't create new class 'Player'";
2696     throw SquirrelError(v, msg.str());
2697   }
2698   sq_pushstring(v, "set_bonus", -1);
2699   sq_newclosure(v, &Player_set_bonus_wrapper, 0);
2700   if(SQ_FAILED(sq_createslot(v, -3))) {
2701     throw SquirrelError(v, "Couldn't register function 'set_bonus'");
2702   }
2703
2704   sq_pushstring(v, "add_coins", -1);
2705   sq_newclosure(v, &Player_add_coins_wrapper, 0);
2706   if(SQ_FAILED(sq_createslot(v, -3))) {
2707     throw SquirrelError(v, "Couldn't register function 'add_coins'");
2708   }
2709
2710   sq_pushstring(v, "make_invincible", -1);
2711   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
2712   if(SQ_FAILED(sq_createslot(v, -3))) {
2713     throw SquirrelError(v, "Couldn't register function 'make_invincible'");
2714   }
2715
2716   sq_pushstring(v, "deactivate", -1);
2717   sq_newclosure(v, &Player_deactivate_wrapper, 0);
2718   if(SQ_FAILED(sq_createslot(v, -3))) {
2719     throw SquirrelError(v, "Couldn't register function 'deactivate'");
2720   }
2721
2722   sq_pushstring(v, "activate", -1);
2723   sq_newclosure(v, &Player_activate_wrapper, 0);
2724   if(SQ_FAILED(sq_createslot(v, -3))) {
2725     throw SquirrelError(v, "Couldn't register function 'activate'");
2726   }
2727
2728   sq_pushstring(v, "walk", -1);
2729   sq_newclosure(v, &Player_walk_wrapper, 0);
2730   if(SQ_FAILED(sq_createslot(v, -3))) {
2731     throw SquirrelError(v, "Couldn't register function 'walk'");
2732   }
2733
2734   sq_pushstring(v, "set_visible", -1);
2735   sq_newclosure(v, &Player_set_visible_wrapper, 0);
2736   if(SQ_FAILED(sq_createslot(v, -3))) {
2737     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2738   }
2739
2740   sq_pushstring(v, "get_visible", -1);
2741   sq_newclosure(v, &Player_get_visible_wrapper, 0);
2742   if(SQ_FAILED(sq_createslot(v, -3))) {
2743     throw SquirrelError(v, "Couldn't register function 'get_visible'");
2744   }
2745
2746   if(SQ_FAILED(sq_createslot(v, -3))) {
2747     throw SquirrelError(v, "Couldn't register class 'Player'");
2748   }
2749
2750   // Register class FloatingImage
2751   sq_pushstring(v, "FloatingImage", -1);
2752   if(sq_newclass(v, SQFalse) < 0) {
2753     std::ostringstream msg;
2754     msg << "Couldn't create new class 'FloatingImage'";
2755     throw SquirrelError(v, msg.str());
2756   }
2757   sq_pushstring(v, "constructor", -1);
2758   sq_newclosure(v, &FloatingImage_constructor_wrapper, 0);
2759   if(SQ_FAILED(sq_createslot(v, -3))) {
2760     throw SquirrelError(v, "Couldn't register function 'constructor'");
2761   }
2762
2763   sq_pushstring(v, "set_layer", -1);
2764   sq_newclosure(v, &FloatingImage_set_layer_wrapper, 0);
2765   if(SQ_FAILED(sq_createslot(v, -3))) {
2766     throw SquirrelError(v, "Couldn't register function 'set_layer'");
2767   }
2768
2769   sq_pushstring(v, "get_layer", -1);
2770   sq_newclosure(v, &FloatingImage_get_layer_wrapper, 0);
2771   if(SQ_FAILED(sq_createslot(v, -3))) {
2772     throw SquirrelError(v, "Couldn't register function 'get_layer'");
2773   }
2774
2775   sq_pushstring(v, "set_pos", -1);
2776   sq_newclosure(v, &FloatingImage_set_pos_wrapper, 0);
2777   if(SQ_FAILED(sq_createslot(v, -3))) {
2778     throw SquirrelError(v, "Couldn't register function 'set_pos'");
2779   }
2780
2781   sq_pushstring(v, "get_pos_x", -1);
2782   sq_newclosure(v, &FloatingImage_get_pos_x_wrapper, 0);
2783   if(SQ_FAILED(sq_createslot(v, -3))) {
2784     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
2785   }
2786
2787   sq_pushstring(v, "get_pos_y", -1);
2788   sq_newclosure(v, &FloatingImage_get_pos_y_wrapper, 0);
2789   if(SQ_FAILED(sq_createslot(v, -3))) {
2790     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
2791   }
2792
2793   sq_pushstring(v, "set_anchor_point", -1);
2794   sq_newclosure(v, &FloatingImage_set_anchor_point_wrapper, 0);
2795   if(SQ_FAILED(sq_createslot(v, -3))) {
2796     throw SquirrelError(v, "Couldn't register function 'set_anchor_point'");
2797   }
2798
2799   sq_pushstring(v, "get_anchor_point", -1);
2800   sq_newclosure(v, &FloatingImage_get_anchor_point_wrapper, 0);
2801   if(SQ_FAILED(sq_createslot(v, -3))) {
2802     throw SquirrelError(v, "Couldn't register function 'get_anchor_point'");
2803   }
2804
2805   sq_pushstring(v, "set_visible", -1);
2806   sq_newclosure(v, &FloatingImage_set_visible_wrapper, 0);
2807   if(SQ_FAILED(sq_createslot(v, -3))) {
2808     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2809   }
2810
2811   sq_pushstring(v, "get_visible", -1);
2812   sq_newclosure(v, &FloatingImage_get_visible_wrapper, 0);
2813   if(SQ_FAILED(sq_createslot(v, -3))) {
2814     throw SquirrelError(v, "Couldn't register function 'get_visible'");
2815   }
2816
2817   if(SQ_FAILED(sq_createslot(v, -3))) {
2818     throw SquirrelError(v, "Couldn't register class 'FloatingImage'");
2819   }
2820
2821 }
2822
2823 } // end of namespace Scripting
2824