/** * WARNING: This file is automatically generated from: * 'src/scripting/wrapper.interface.hpp' * DO NOT CHANGE */ #include #include #include #include #include #include #include "squirrel_error.hpp" #include "wrapper.interface.hpp" namespace Scripting { namespace Wrapper { static SQInteger GameObject_release_hook(SQUserPointer ptr, SQInteger ) { Scripting::GameObject* _this = reinterpret_cast (ptr); delete _this; return 0; } static SQInteger GameObject_get_name_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'get_name' called without instance")); return SQ_ERROR; } Scripting::GameObject* _this = reinterpret_cast (data); try { const std::string& return_value = _this->get_name(); sq_pushstring(vm, return_value.c_str(), return_value.size()); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_name'")); return SQ_ERROR; } } static SQInteger GameObject_remove_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'remove' called without instance")); return SQ_ERROR; } Scripting::GameObject* _this = reinterpret_cast (data); try { _this->remove(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'remove'")); return SQ_ERROR; } } static SQInteger GameObject_set_active_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'set_active' called without instance")); return SQ_ERROR; } Scripting::GameObject* _this = reinterpret_cast (data); SQBool arg0; if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a bool")); return SQ_ERROR; } try { _this->set_active(arg0 == SQTrue); 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_active'")); return SQ_ERROR; } } static SQInteger GameObject_set_parent_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'set_parent' called without instance")); return SQ_ERROR; } Scripting::GameObject* _this = reinterpret_cast (data); const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { _this->set_parent(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_parent'")); return SQ_ERROR; } } static SQInteger TestObject_release_hook(SQUserPointer ptr, SQInteger ) { Scripting::TestObject* _this = reinterpret_cast (ptr); delete _this; return 0; } static SQInteger TestObject_set_sprite_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'set_sprite' called without instance")); return SQ_ERROR; } Scripting::TestObject* _this = reinterpret_cast (data); const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { _this->set_sprite(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_sprite'")); return SQ_ERROR; } } static SQInteger TestObject_set_action_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'set_action' called without instance")); return SQ_ERROR; } Scripting::TestObject* _this = reinterpret_cast (data); const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { _this->set_action(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_action'")); return SQ_ERROR; } } static SQInteger TestObject_set_pos_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'set_pos' called without instance")); return SQ_ERROR; } Scripting::TestObject* _this = reinterpret_cast (data); SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a float")); return SQ_ERROR; } try { _this->set_pos(static_cast (arg0), static_cast (arg1)); 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_pos'")); return SQ_ERROR; } } static SQInteger TestObject_set_vflip_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'set_vflip' called without instance")); return SQ_ERROR; } Scripting::TestObject* _this = reinterpret_cast (data); SQBool arg0; if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a bool")); return SQ_ERROR; } try { _this->set_vflip(arg0 == SQTrue); 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_vflip'")); return SQ_ERROR; } } static SQInteger TestObject_attach_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'attach' called without instance")); return SQ_ERROR; } Scripting::TestObject* _this = reinterpret_cast (data); const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } const SQChar* arg1; if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a string")); return SQ_ERROR; } try { _this->attach(arg0, arg1); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'attach'")); return SQ_ERROR; } } static SQInteger Player_release_hook(SQUserPointer ptr, SQInteger ) { Scripting::Player* _this = reinterpret_cast (ptr); delete _this; return 0; } static SQInteger Player_start_listening_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'start_listening' called without instance")); return SQ_ERROR; } Scripting::Player* _this = reinterpret_cast (data); try { _this->start_listening(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'start_listening'")); return SQ_ERROR; } } static SQInteger Player_stop_listening_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'stop_listening' called without instance")); return SQ_ERROR; } Scripting::Player* _this = reinterpret_cast (data); try { _this->stop_listening(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'stop_listening'")); return SQ_ERROR; } } static SQInteger ScriptableObject_release_hook(SQUserPointer ptr, SQInteger ) { Scripting::ScriptableObject* _this = reinterpret_cast (ptr); delete _this; return 0; } static SQInteger ScriptableObject_move_to_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'move_to' called without instance")); return SQ_ERROR; } Scripting::ScriptableObject* _this = reinterpret_cast (data); SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a float")); return SQ_ERROR; } SQFloat arg2; if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) { sq_throwerror(vm, _SC("Argument 3 not a float")); return SQ_ERROR; } SQFloat arg3; if(SQ_FAILED(sq_getfloat(vm, 5, &arg3))) { sq_throwerror(vm, _SC("Argument 4 not a float")); return SQ_ERROR; } try { _this->move_to(static_cast (arg0), static_cast (arg1), static_cast (arg2), static_cast (arg3)); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'move_to'")); return SQ_ERROR; } } static SQInteger ScriptableObject_start_flash_wrapper(HSQUIRRELVM vm) { SQUserPointer data; if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { sq_throwerror(vm, _SC("'start_flash' called without instance")); return SQ_ERROR; } Scripting::ScriptableObject* _this = reinterpret_cast (data); SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { _this->start_flash(static_cast (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 'start_flash'")); return SQ_ERROR; } } static SQInteger set_sector_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::set_sector(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_sector'")); return SQ_ERROR; } } static SQInteger play_music_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::play_music(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 'play_music'")); return SQ_ERROR; } } static SQInteger stop_music_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { Scripting::stop_music(static_cast (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 'stop_music'")); return SQ_ERROR; } } static SQInteger play_sound_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::play_sound(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 'play_sound'")); return SQ_ERROR; } } static SQInteger caption_add_wrapper(HSQUIRRELVM vm) { SQInteger arg0; if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not an integer")); return SQ_ERROR; } const SQChar* arg1; if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a string")); return SQ_ERROR; } try { Scripting::caption_add(static_cast (arg0), arg1); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'caption_add'")); return SQ_ERROR; } } static SQInteger caption_clear_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::caption_clear(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'caption_clear'")); return SQ_ERROR; } } static SQInteger caption_end_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::caption_end(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'caption_end'")); return SQ_ERROR; } } static SQInteger camera_set_active_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::camera_set_active(arg0 == SQTrue); 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_set_active'")); return SQ_ERROR; } } static SQInteger camera_continue_path_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::camera_continue_path(); 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_continue_path'")); return SQ_ERROR; } } static SQInteger camera_begin_path_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::camera_begin_path(); 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_begin_path'")); return SQ_ERROR; } } static SQInteger camera_add_point_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a float")); return SQ_ERROR; } SQFloat arg2; if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) { sq_throwerror(vm, _SC("Argument 3 not a float")); return SQ_ERROR; } try { Scripting::camera_add_point(static_cast (arg0), static_cast (arg1), static_cast (arg2)); 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_add_point'")); return SQ_ERROR; } } static SQInteger camera_end_path_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::camera_end_path(); 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_end_path'")); return SQ_ERROR; } } static SQInteger camera_set_pos_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a float")); return SQ_ERROR; } try { Scripting::camera_set_pos(static_cast (arg0), static_cast (arg1)); 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_set_pos'")); return SQ_ERROR; } } static SQInteger camera_set_zoom_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { Scripting::camera_set_zoom(static_cast (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 'camera_set_zoom'")); return SQ_ERROR; } } static SQInteger set_controller_help_active_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::set_controller_help_active(arg0 == SQTrue); 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_controller_help_active'")); return SQ_ERROR; } } static SQInteger dialog_show_wrapper(HSQUIRRELVM vm) { SQInteger arg0; if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not an integer")); return SQ_ERROR; } const SQChar* arg1; if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a string")); return SQ_ERROR; } const SQChar* arg2; if(SQ_FAILED(sq_getstring(vm, 4, &arg2))) { sq_throwerror(vm, _SC("Argument 3 not a string")); return SQ_ERROR; } const SQChar* arg3; if(SQ_FAILED(sq_getstring(vm, 5, &arg3))) { sq_throwerror(vm, _SC("Argument 4 not a string")); return SQ_ERROR; } try { Scripting::dialog_show(static_cast (arg0), arg1, arg2, arg3); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'dialog_show'")); return SQ_ERROR; } } static SQInteger wait_for_dialog_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; try { Scripting::wait_for_dialog(arg0); return sq_suspendvm(vm); } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_dialog'")); return SQ_ERROR; } } static SQInteger wait_for_fade_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; try { Scripting::wait_for_fade(arg0); return sq_suspendvm(vm); } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_fade'")); return SQ_ERROR; } } static SQInteger wait_for_camera_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; try { Scripting::wait_for_camera(arg0); return sq_suspendvm(vm); } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_camera'")); return SQ_ERROR; } } static SQInteger conversation_add_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::conversation_add(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 'conversation_add'")); return SQ_ERROR; } } static SQInteger conversation_show_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::conversation_show(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'conversation_show'")); return SQ_ERROR; } } static SQInteger conversation_get_selection_wrapper(HSQUIRRELVM vm) { try { int return_value = Scripting::conversation_get_selection(); sq_pushinteger(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'conversation_get_selection'")); return SQ_ERROR; } } static SQInteger wait_for_conversation_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; try { Scripting::wait_for_conversation(arg0); return sq_suspendvm(vm); } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_conversation'")); return SQ_ERROR; } } static SQInteger add_objective_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } const SQChar* arg1; if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a string")); return SQ_ERROR; } try { Scripting::add_objective(arg0, arg1); 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_objective'")); return SQ_ERROR; } } static SQInteger objective_complete_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::objective_complete(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 'objective_complete'")); return SQ_ERROR; } } static SQInteger is_objective_given_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { bool return_value = Scripting::is_objective_given(arg0); sq_pushbool(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_objective_given'")); return SQ_ERROR; } } static SQInteger is_objective_complete_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { bool return_value = Scripting::is_objective_complete(arg0); sq_pushbool(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_objective_complete'")); return SQ_ERROR; } } static SQInteger run_before_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; try { bool return_value = Scripting::run_before(arg0); sq_pushbool(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'run_before'")); return SQ_ERROR; } } static SQInteger save_state_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; const SQChar* arg1; if(SQ_FAILED(sq_getstring(vm, 2, &arg1))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::save_state(arg0, arg1); 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 SQInteger load_state_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; const SQChar* arg1; if(SQ_FAILED(sq_getstring(vm, 2, &arg1))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } try { Scripting::load_state(arg0, arg1); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_state'")); return SQ_ERROR; } } static SQInteger list_objects_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::list_objects(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'list_objects'")); return SQ_ERROR; } } static SQInteger set_debug_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::set_debug(arg0 == SQTrue); 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_debug'")); return SQ_ERROR; } } static SQInteger get_debug_wrapper(HSQUIRRELVM vm) { try { bool return_value = Scripting::get_debug(); sq_pushbool(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_debug'")); return SQ_ERROR; } } static SQInteger get_game_speed_wrapper(HSQUIRRELVM vm) { try { float return_value = Scripting::get_game_speed(); sq_pushfloat(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_game_speed'")); return SQ_ERROR; } } static SQInteger set_game_speed_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { Scripting::set_game_speed(static_cast (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_game_speed'")); return SQ_ERROR; } } static SQInteger wait_wrapper(HSQUIRRELVM vm) { HSQUIRRELVM arg0 = vm; SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 2, &arg1))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { Scripting::wait(arg0, static_cast (arg1)); return sq_suspendvm(vm); } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait'")); return SQ_ERROR; } } static SQInteger display_wrapper(HSQUIRRELVM vm) { return Scripting::display(vm); } static SQInteger println_wrapper(HSQUIRRELVM vm) { return Scripting::println(vm); } static SQInteger set_console_font_wrapper(HSQUIRRELVM vm) { const SQChar* arg0; if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a string")); return SQ_ERROR; } SQInteger arg1; if(SQ_FAILED(sq_getinteger(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not an integer")); return SQ_ERROR; } try { Scripting::set_console_font(arg0, static_cast (arg1)); 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_console_font'")); return SQ_ERROR; } } static SQInteger set_gamma_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { Scripting::set_gamma(static_cast (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_gamma'")); return SQ_ERROR; } } static SQInteger set_gamma_rgb_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a float")); return SQ_ERROR; } SQFloat arg2; if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) { sq_throwerror(vm, _SC("Argument 3 not a float")); return SQ_ERROR; } try { Scripting::set_gamma_rgb(static_cast (arg0), static_cast (arg1), static_cast (arg2)); 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_gamma_rgb'")); return SQ_ERROR; } } static SQInteger show_config_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::show_config(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'show_config'")); return SQ_ERROR; } } static SQInteger cutscene_begin_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::cutscene_begin(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'cutscene_begin'")); return SQ_ERROR; } } static SQInteger cutscene_end_wrapper(HSQUIRRELVM vm) { (void) vm; try { Scripting::cutscene_end(); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'cutscene_end'")); return SQ_ERROR; } } static SQInteger internal_fadeout_rgb_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } SQFloat arg1; if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) { sq_throwerror(vm, _SC("Argument 2 not a float")); return SQ_ERROR; } SQFloat arg2; if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) { sq_throwerror(vm, _SC("Argument 3 not a float")); return SQ_ERROR; } SQFloat arg3; if(SQ_FAILED(sq_getfloat(vm, 5, &arg3))) { sq_throwerror(vm, _SC("Argument 4 not a float")); return SQ_ERROR; } try { Scripting::internal_fadeout_rgb(static_cast (arg0), static_cast (arg1), static_cast (arg2), static_cast (arg3)); return 0; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'internal_fadeout_rgb'")); return SQ_ERROR; } } static SQInteger internal_fadein_wrapper(HSQUIRRELVM vm) { SQFloat arg0; if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not a float")); return SQ_ERROR; } try { Scripting::internal_fadein(static_cast (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 'internal_fadein'")); return SQ_ERROR; } } static SQInteger render_mask_get_wrapper(HSQUIRRELVM vm) { try { int return_value = Scripting::render_mask_get(); sq_pushinteger(vm, return_value); return 1; } catch(std::exception& e) { sq_throwerror(vm, e.what()); return SQ_ERROR; } catch(...) { sq_throwerror(vm, _SC("Unexpected exception while executing function 'render_mask_get'")); return SQ_ERROR; } } static SQInteger render_mask_set_wrapper(HSQUIRRELVM vm) { SQInteger arg0; if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) { sq_throwerror(vm, _SC("Argument 1 not an integer")); return SQ_ERROR; } try { Scripting::render_mask_set(static_cast (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 'render_mask_set'")); return SQ_ERROR; } } static SQInteger spawn_object_wrapper(HSQUIRRELVM vm) { return Scripting::spawn_object(vm); } } // end of namespace Wrapper void create_squirrel_instance(HSQUIRRELVM v, Scripting::GameObject* object, bool setup_releasehook) { using namespace Wrapper; sq_pushroottable(v); sq_pushstring(v, "GameObject", -1); if(SQ_FAILED(sq_get(v, -2))) { std::ostringstream msg; msg << "Couldn't resolved squirrel type 'GameObject'"; throw SquirrelError(v, msg.str()); } if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { std::ostringstream msg; msg << "Couldn't setup squirrel instance for object of type 'GameObject'"; throw SquirrelError(v, msg.str()); } sq_remove(v, -2); // remove object name if(setup_releasehook) { sq_setreleasehook(v, -1, GameObject_release_hook); } sq_remove(v, -2); // remove root table } void create_squirrel_instance(HSQUIRRELVM v, Scripting::TestObject* object, bool setup_releasehook) { using namespace Wrapper; sq_pushroottable(v); sq_pushstring(v, "TestObject", -1); if(SQ_FAILED(sq_get(v, -2))) { std::ostringstream msg; msg << "Couldn't resolved squirrel type 'TestObject'"; throw SquirrelError(v, msg.str()); } if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { std::ostringstream msg; msg << "Couldn't setup squirrel instance for object of type 'TestObject'"; throw SquirrelError(v, msg.str()); } sq_remove(v, -2); // remove object name if(setup_releasehook) { sq_setreleasehook(v, -1, TestObject_release_hook); } sq_remove(v, -2); // remove root table } void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook) { using namespace Wrapper; sq_pushroottable(v); sq_pushstring(v, "Player", -1); if(SQ_FAILED(sq_get(v, -2))) { std::ostringstream msg; msg << "Couldn't resolved squirrel type 'Player'"; throw SquirrelError(v, msg.str()); } if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { std::ostringstream msg; msg << "Couldn't setup squirrel instance for object of type 'Player'"; throw SquirrelError(v, msg.str()); } sq_remove(v, -2); // remove object name if(setup_releasehook) { sq_setreleasehook(v, -1, Player_release_hook); } sq_remove(v, -2); // remove root table } void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptableObject* object, bool setup_releasehook) { using namespace Wrapper; sq_pushroottable(v); sq_pushstring(v, "ScriptableObject", -1); if(SQ_FAILED(sq_get(v, -2))) { std::ostringstream msg; msg << "Couldn't resolved squirrel type 'ScriptableObject'"; throw SquirrelError(v, msg.str()); } if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { std::ostringstream msg; msg << "Couldn't setup squirrel instance for object of type 'ScriptableObject'"; throw SquirrelError(v, msg.str()); } sq_remove(v, -2); // remove object name if(setup_releasehook) { sq_setreleasehook(v, -1, ScriptableObject_release_hook); } sq_remove(v, -2); // remove root table } void register_windstille_wrapper(HSQUIRRELVM v) { using namespace Wrapper; sq_pushstring(v, "VCENTER", -1); sq_pushinteger(v, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register constant 'VCENTER'"); } sq_pushstring(v, "LEFT", -1); sq_pushinteger(v, 1); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register constant 'LEFT'"); } sq_pushstring(v, "RIGHT", -1); sq_pushinteger(v, 2); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register constant 'RIGHT'"); } sq_pushstring(v, "HCENTER", -1); sq_pushinteger(v, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register constant 'HCENTER'"); } sq_pushstring(v, "TOP", -1); sq_pushinteger(v, 16); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register constant 'TOP'"); } sq_pushstring(v, "BOTTOM", -1); sq_pushinteger(v, 32); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register constant 'BOTTOM'"); } sq_pushstring(v, "set_sector", -1); sq_newclosure(v, &set_sector_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_sector'"); } sq_pushstring(v, "play_music", -1); sq_newclosure(v, &play_music_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'play_music'"); } sq_pushstring(v, "stop_music", -1); sq_newclosure(v, &stop_music_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'stop_music'"); } sq_pushstring(v, "play_sound", -1); sq_newclosure(v, &play_sound_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'play_sound'"); } sq_pushstring(v, "caption_add", -1); sq_newclosure(v, &caption_add_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'caption_add'"); } sq_pushstring(v, "caption_clear", -1); sq_newclosure(v, &caption_clear_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'caption_clear'"); } sq_pushstring(v, "caption_end", -1); sq_newclosure(v, &caption_end_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'caption_end'"); } sq_pushstring(v, "camera_set_active", -1); sq_newclosure(v, &camera_set_active_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_set_active'"); } sq_pushstring(v, "camera_continue_path", -1); sq_newclosure(v, &camera_continue_path_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_continue_path'"); } sq_pushstring(v, "camera_begin_path", -1); sq_newclosure(v, &camera_begin_path_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_begin_path'"); } sq_pushstring(v, "camera_add_point", -1); sq_newclosure(v, &camera_add_point_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_add_point'"); } sq_pushstring(v, "camera_end_path", -1); sq_newclosure(v, &camera_end_path_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_end_path'"); } sq_pushstring(v, "camera_set_pos", -1); sq_newclosure(v, &camera_set_pos_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_set_pos'"); } sq_pushstring(v, "camera_set_zoom", -1); sq_newclosure(v, &camera_set_zoom_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'camera_set_zoom'"); } sq_pushstring(v, "set_controller_help_active", -1); sq_newclosure(v, &set_controller_help_active_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_controller_help_active'"); } sq_pushstring(v, "dialog_show", -1); sq_newclosure(v, &dialog_show_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'dialog_show'"); } sq_pushstring(v, "wait_for_dialog", -1); sq_newclosure(v, &wait_for_dialog_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'wait_for_dialog'"); } sq_pushstring(v, "wait_for_fade", -1); sq_newclosure(v, &wait_for_fade_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'wait_for_fade'"); } sq_pushstring(v, "wait_for_camera", -1); sq_newclosure(v, &wait_for_camera_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'wait_for_camera'"); } sq_pushstring(v, "conversation_add", -1); sq_newclosure(v, &conversation_add_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'conversation_add'"); } sq_pushstring(v, "conversation_show", -1); sq_newclosure(v, &conversation_show_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'conversation_show'"); } sq_pushstring(v, "conversation_get_selection", -1); sq_newclosure(v, &conversation_get_selection_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'conversation_get_selection'"); } sq_pushstring(v, "wait_for_conversation", -1); sq_newclosure(v, &wait_for_conversation_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'wait_for_conversation'"); } sq_pushstring(v, "add_objective", -1); sq_newclosure(v, &add_objective_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'add_objective'"); } sq_pushstring(v, "objective_complete", -1); sq_newclosure(v, &objective_complete_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'objective_complete'"); } sq_pushstring(v, "is_objective_given", -1); sq_newclosure(v, &is_objective_given_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'is_objective_given'"); } sq_pushstring(v, "is_objective_complete", -1); sq_newclosure(v, &is_objective_complete_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'is_objective_complete'"); } sq_pushstring(v, "run_before", -1); sq_newclosure(v, &run_before_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'run_before'"); } 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, "load_state", -1); sq_newclosure(v, &load_state_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'load_state'"); } sq_pushstring(v, "list_objects", -1); sq_newclosure(v, &list_objects_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'list_objects'"); } sq_pushstring(v, "set_debug", -1); sq_newclosure(v, &set_debug_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_debug'"); } sq_pushstring(v, "get_debug", -1); sq_newclosure(v, &get_debug_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'get_debug'"); } sq_pushstring(v, "get_game_speed", -1); sq_newclosure(v, &get_game_speed_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'get_game_speed'"); } sq_pushstring(v, "set_game_speed", -1); sq_newclosure(v, &set_game_speed_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_game_speed'"); } sq_pushstring(v, "wait", -1); sq_newclosure(v, &wait_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'wait'"); } sq_pushstring(v, "display", -1); sq_newclosure(v, &display_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'display'"); } sq_pushstring(v, "println", -1); sq_newclosure(v, &println_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'println'"); } sq_pushstring(v, "set_console_font", -1); sq_newclosure(v, &set_console_font_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_console_font'"); } sq_pushstring(v, "set_gamma", -1); sq_newclosure(v, &set_gamma_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_gamma'"); } sq_pushstring(v, "set_gamma_rgb", -1); sq_newclosure(v, &set_gamma_rgb_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_gamma_rgb'"); } sq_pushstring(v, "show_config", -1); sq_newclosure(v, &show_config_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'show_config'"); } sq_pushstring(v, "cutscene_begin", -1); sq_newclosure(v, &cutscene_begin_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'cutscene_begin'"); } sq_pushstring(v, "cutscene_end", -1); sq_newclosure(v, &cutscene_end_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'cutscene_end'"); } sq_pushstring(v, "internal_fadeout_rgb", -1); sq_newclosure(v, &internal_fadeout_rgb_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'internal_fadeout_rgb'"); } sq_pushstring(v, "internal_fadein", -1); sq_newclosure(v, &internal_fadein_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'internal_fadein'"); } sq_pushstring(v, "render_mask_get", -1); sq_newclosure(v, &render_mask_get_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'render_mask_get'"); } sq_pushstring(v, "render_mask_set", -1); sq_newclosure(v, &render_mask_set_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'render_mask_set'"); } sq_pushstring(v, "spawn_object", -1); sq_newclosure(v, &spawn_object_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'spawn_object'"); } // Register class GameObject sq_pushstring(v, "GameObject", -1); if(sq_newclass(v, SQFalse) < 0) { std::ostringstream msg; msg << "Couldn't create new class 'GameObject'"; throw SquirrelError(v, msg.str()); } sq_pushstring(v, "get_name", -1); sq_newclosure(v, &GameObject_get_name_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'get_name'"); } sq_pushstring(v, "remove", -1); sq_newclosure(v, &GameObject_remove_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'remove'"); } sq_pushstring(v, "set_active", -1); sq_newclosure(v, &GameObject_set_active_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_active'"); } sq_pushstring(v, "set_parent", -1); sq_newclosure(v, &GameObject_set_parent_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_parent'"); } if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register class 'GameObject'"); } // Register class TestObject sq_pushstring(v, "TestObject", -1); sq_pushstring(v, "GameObject", -1); sq_get(v, -3); if(sq_newclass(v, SQTrue) < 0) { std::ostringstream msg; msg << "Couldn't create new class 'TestObject'"; throw SquirrelError(v, msg.str()); } sq_pushstring(v, "set_sprite", -1); sq_newclosure(v, &TestObject_set_sprite_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_sprite'"); } sq_pushstring(v, "set_action", -1); sq_newclosure(v, &TestObject_set_action_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_action'"); } sq_pushstring(v, "set_pos", -1); sq_newclosure(v, &TestObject_set_pos_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_pos'"); } sq_pushstring(v, "set_vflip", -1); sq_newclosure(v, &TestObject_set_vflip_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'set_vflip'"); } sq_pushstring(v, "attach", -1); sq_newclosure(v, &TestObject_attach_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'attach'"); } if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register class 'TestObject'"); } // Register class Player sq_pushstring(v, "Player", -1); sq_pushstring(v, "GameObject", -1); sq_get(v, -3); if(sq_newclass(v, SQTrue) < 0) { std::ostringstream msg; msg << "Couldn't create new class 'Player'"; throw SquirrelError(v, msg.str()); } sq_pushstring(v, "start_listening", -1); sq_newclosure(v, &Player_start_listening_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'start_listening'"); } sq_pushstring(v, "stop_listening", -1); sq_newclosure(v, &Player_stop_listening_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'stop_listening'"); } if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register class 'Player'"); } // Register class ScriptableObject sq_pushstring(v, "ScriptableObject", -1); sq_pushstring(v, "GameObject", -1); sq_get(v, -3); if(sq_newclass(v, SQTrue) < 0) { std::ostringstream msg; msg << "Couldn't create new class 'ScriptableObject'"; throw SquirrelError(v, msg.str()); } sq_pushstring(v, "move_to", -1); sq_newclosure(v, &ScriptableObject_move_to_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'move_to'"); } sq_pushstring(v, "start_flash", -1); sq_newclosure(v, &ScriptableObject_start_flash_wrapper, 0); if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register function 'start_flash'"); } if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register class 'ScriptableObject'"); } } } // end of namespace Scripting