return 0;
}
+static int Player_set_bonus_wrapper(HSQUIRRELVM vm)
+{
+ Scripting::Player* _this;
+ if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
+ sq_throwerror(vm, _SC("'set_bonus' called without instance"));
+ return SQ_ERROR;
+ }
+ const char* arg0;
+ if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
+ sq_throwerror(vm, _SC("Argument 1 not a string"));
+ return SQ_ERROR;
+ }
+
+ try {
+ _this->set_bonus(arg0);
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_bonus'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int Player_add_coins_wrapper(HSQUIRRELVM vm)
+{
+ Scripting::Player* _this;
+ if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
+ sq_throwerror(vm, _SC("'add_coins' called without instance"));
+ return SQ_ERROR;
+ }
+ int arg0;
+ if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
+ sq_throwerror(vm, _SC("Argument 1 not an integer"));
+ return SQ_ERROR;
+ }
+
+ try {
+ _this->add_coins(arg0);
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_coins'"));
+ return SQ_ERROR;
+ }
+
+}
+
static int Player_make_invincible_wrapper(HSQUIRRELVM vm)
{
Scripting::Player* _this;
}
+static int exit_screen_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::exit_screen();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'exit_screen'"));
+ return SQ_ERROR;
+ }
+
+}
+
static int translate_wrapper(HSQUIRRELVM vm)
{
const char* arg0;
}
+static int save_state_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::save_state();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'save_state'"));
+ return SQ_ERROR;
+ }
+
+}
+
static int add_key_wrapper(HSQUIRRELVM vm)
{
int arg0;
}
+static int debug_collrects_wrapper(HSQUIRRELVM vm)
+{
+ SQBool arg0;
+ if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
+ sq_throwerror(vm, _SC("Argument 1 not a bool"));
+ return SQ_ERROR;
+ }
+
+ try {
+ Scripting::debug_collrects(arg0);
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_collrects'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int draw_solids_only_wrapper(HSQUIRRELVM vm)
+{
+ SQBool arg0;
+ if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
+ sq_throwerror(vm, _SC("Argument 1 not a bool"));
+ return SQ_ERROR;
+ }
+
+ try {
+ Scripting::draw_solids_only(arg0);
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'draw_solids_only'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int grease_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::grease();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'grease'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int invincible_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::invincible();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'invincible'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int mortal_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::mortal();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'mortal'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int shrink_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::shrink();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'shrink'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int kill_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::kill();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'kill'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int restart_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::restart();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'restart'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int whereami_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::whereami();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'whereami'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int gotoend_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::gotoend();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'gotoend'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int flip_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::flip();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'flip'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int finish_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::finish();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'finish'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int camera_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::camera();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'camera'"));
+ return SQ_ERROR;
+ }
+
+}
+
+static int quit_wrapper(HSQUIRRELVM vm)
+{
+ (void) vm;
+
+ try {
+ Scripting::quit();
+
+ return 0;
+
+ } catch(std::exception& e) {
+ sq_throwerror(vm, e.what());
+ return SQ_ERROR;
+ } catch(...) {
+ sq_throwerror(vm, _SC("Unexpected exception while executing function 'quit'"));
+ return SQ_ERROR;
+ }
+
+}
+
} // end of namespace Wrapper
void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
{
using namespace Wrapper;
- sq_pushroottable(v);
sq_pushstring(v, "KEY_BRASS", -1);
sq_pushinteger(v, 1);
if(SQ_FAILED(sq_createslot(v, -3))) {
throw SquirrelError(v, "Couldn't register function 'wait_for_screenswitch'");
}
+ sq_pushstring(v, "exit_screen", -1);
+ sq_newclosure(v, &exit_screen_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'exit_screen'");
+ }
+
sq_pushstring(v, "translate", -1);
sq_newclosure(v, &translate_wrapper, 0);
if(SQ_FAILED(sq_createslot(v, -3))) {
throw SquirrelError(v, "Couldn't register function 'import'");
}
+ sq_pushstring(v, "save_state", -1);
+ sq_newclosure(v, &save_state_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'save_state'");
+ }
+
sq_pushstring(v, "add_key", -1);
sq_newclosure(v, &add_key_wrapper, 0);
if(SQ_FAILED(sq_createslot(v, -3))) {
throw SquirrelError(v, "Couldn't register function 'add_key'");
}
+ sq_pushstring(v, "debug_collrects", -1);
+ sq_newclosure(v, &debug_collrects_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'debug_collrects'");
+ }
+
+ sq_pushstring(v, "draw_solids_only", -1);
+ sq_newclosure(v, &draw_solids_only_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'draw_solids_only'");
+ }
+
+ sq_pushstring(v, "grease", -1);
+ sq_newclosure(v, &grease_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'grease'");
+ }
+
+ sq_pushstring(v, "invincible", -1);
+ sq_newclosure(v, &invincible_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'invincible'");
+ }
+
+ sq_pushstring(v, "mortal", -1);
+ sq_newclosure(v, &mortal_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'mortal'");
+ }
+
+ sq_pushstring(v, "shrink", -1);
+ sq_newclosure(v, &shrink_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'shrink'");
+ }
+
+ sq_pushstring(v, "kill", -1);
+ sq_newclosure(v, &kill_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'kill'");
+ }
+
+ sq_pushstring(v, "restart", -1);
+ sq_newclosure(v, &restart_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'restart'");
+ }
+
+ sq_pushstring(v, "whereami", -1);
+ sq_newclosure(v, &whereami_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'whereami'");
+ }
+
+ sq_pushstring(v, "gotoend", -1);
+ sq_newclosure(v, &gotoend_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'gotoend'");
+ }
+
+ sq_pushstring(v, "flip", -1);
+ sq_newclosure(v, &flip_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'flip'");
+ }
+
+ sq_pushstring(v, "finish", -1);
+ sq_newclosure(v, &finish_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'finish'");
+ }
+
+ sq_pushstring(v, "camera", -1);
+ sq_newclosure(v, &camera_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'camera'");
+ }
+
+ sq_pushstring(v, "quit", -1);
+ sq_newclosure(v, &quit_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'quit'");
+ }
+
// Register class DisplayEffect
sq_pushstring(v, "DisplayEffect", -1);
if(sq_newclass(v, SQFalse) < 0) {
msg << "Couldn't create new class 'Player'";
throw SquirrelError(v, msg.str());
}
+ sq_pushstring(v, "set_bonus", -1);
+ sq_newclosure(v, &Player_set_bonus_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'set_bonus'");
+ }
+
+ sq_pushstring(v, "add_coins", -1);
+ sq_newclosure(v, &Player_add_coins_wrapper, 0);
+ if(SQ_FAILED(sq_createslot(v, -3))) {
+ throw SquirrelError(v, "Couldn't register function 'add_coins'");
+ }
+
sq_pushstring(v, "make_invincible", -1);
sq_newclosure(v, &Player_make_invincible_wrapper, 0);
if(SQ_FAILED(sq_createslot(v, -3))) {
throw SquirrelError(v, "Couldn't register class 'FloatingImage'");
}
- sq_pop(v, 1);
}
} // end of namespace Scripting