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