Classes | |
class | AmbientSound |
class | Camera |
class | Candle |
class | DisplayEffect |
class | FloatingImage |
class | LevelTime |
class | Platform |
class | Player |
class | ScriptedObject |
class | SquirrelError |
Exception class for squirrel errors, it takes a squirrelvm and uses sq_geterror() to retrieve additional information about the last error that occurred and creates a readable message from that. More... | |
class | SSector |
class | Text |
class | ThreadQueue |
Keeps a list of SquirrelThreads that wait for a wakeup event. More... | |
class | Thunderstorm |
class | TileMap |
class | TimeScheduler |
This class keeps a list of squirrel threads that are scheduled for a certain time. More... | |
class | WillOWisp |
class | Wind |
Namespaces | |
namespace | wrapper |
Functions | |
SQInteger | display (HSQUIRRELVM vm) __custom("t.") |
Display the value of the argument. | |
void | print_stacktrace (HSQUIRRELVM vm) |
Displays contents of the current stack. | |
SQInteger | get_current_thread (HSQUIRRELVM vm) __custom("t") |
returns the currently running thread | |
void | wait (HSQUIRRELVM vm, float seconds) __suspend |
Suspend the script execution for the specified number of seconds. | |
void | wait_for_screenswitch (HSQUIRRELVM vm) __suspend |
Suspend the script execution until the current screen has been changed. | |
void | exit_screen () |
Exits the currently running screen (force exit from worldmap or scrolling text for example). | |
void | fadeout_screen (float seconds) |
Does a fadeout for the specified number of seconds before next screenchange. | |
void | shrink_screen (float dest_x, float dest_y, float seconds) |
Does a shrinking fade towards the destposition for the specified number of seconds before next screenchange. | |
void | abort_screenfade () |
Aborts any kind of previous screen fade; the screenchange will happen anyway. | |
std::string | translate (const std::string &text) |
Translate a text into the users language (by looking it up in the .po files). | |
void | display_text_file (const std::string &filename) |
Display a text file and scrolls it over the screen (on next screenswitch). | |
void | load_worldmap (const std::string &filename) |
Load and display a worldmap (on next screenswitch). | |
void | load_level (const std::string &filename) |
Load and display a level (on next screenswitch). | |
void | import (HSQUIRRELVM v, const std::string &filename) |
Load a script file and executes it. | |
void | debug_collrects (bool enable) |
enable/disable drawing of collision rectangles | |
void | debug_show_fps (bool enable) |
enable/disable drawing of fps | |
void | debug_draw_solids_only (bool enable) |
enable/disable drawing of non-solid layers | |
void | debug_draw_editor_images (bool enable) |
enable/disable drawing of editor images | |
void | debug_worldmap_ghost (bool enable) |
enable/disable worldmap ghost mode | |
void | save_state () |
Save world state to savegame. | |
void | update_worldmap () |
Update worldmap from worldmap state (state.world variable). | |
bool | validate_sector_player () |
void | play_music (const std::string &musicfile) |
Changes music to musicfile. | |
void | play_sound (const std::string &soundfile) |
Plays a soundfile. | |
void | grease () |
speeds Tux up | |
void | invincible () |
makes Tux invincible for 10000 units of time | |
void | ghost () |
makes Tux a ghost, i.e. | |
void | mortal () |
recall Tux's invincibility and ghost status | |
void | restart () |
reinitialise and respawn Tux at the beginning of the current level | |
void | whereami () |
print Tux's current coordinates in a level | |
void | gotoend () |
move Tux near the end of the level | |
void | camera () |
show the camera's coordinates | |
void | set_gamma (float gamma) |
adjust gamma | |
void | quit () |
exit the game | |
int | rand () |
Returns a random integer. | |
void | set_game_speed (float speed) |
Set the game_speed. | |
void | record_demo (const std::string &filename) |
Record a demo to the given file. | |
void | play_demo (const std::string &filename) |
Play back a demo from the given file. | |
void | Level_finish (bool win) |
Instantly finish the currently played level. | |
void | Level_spawn (const std::string §or, const std::string &spawnpoint) |
spawn tux at specified sector and spawnpoint | |
void | Level_flip_vertically () |
Flip level vertically. | |
void | Level_toggle_pause () |
toggle pause | |
void | Level_edit (bool edit_mode) |
Switch to and from edit mode. | |
void | load_squirrel_table (HSQUIRRELVM vm, SQInteger table_idx, const Reader &lisp) |
void | save_squirrel_table (HSQUIRRELVM vm, SQInteger table_idx, Writer &writer) |
static void | printfunc (HSQUIRRELVM, const char *str,...) |
void | init_squirrel (bool enable_debugger) |
void | exit_squirrel () |
void | update_debugger () |
std::string | squirrel2string (HSQUIRRELVM v, SQInteger i) |
void | print_squirrel_stack (HSQUIRRELVM v) |
SQInteger | squirrel_read_char (SQUserPointer file) |
void | compile_script (HSQUIRRELVM vm, std::istream &in, const std::string &sourcename) |
void | compile_and_run (HSQUIRRELVM vm, std::istream &in, const std::string &sourcename) |
HSQOBJECT | create_thread (HSQUIRRELVM vm) |
HSQOBJECT | vm_to_object (HSQUIRRELVM vm) |
HSQUIRRELVM | object_to_vm (HSQOBJECT object) |
void | store_float (HSQUIRRELVM vm, const char *name, float val) |
void | store_int (HSQUIRRELVM vm, const char *name, int val) |
void | store_string (HSQUIRRELVM vm, const char *name, const std::string &val) |
void | store_bool (HSQUIRRELVM vm, const char *name, bool val) |
bool | has_float (HSQUIRRELVM vm, const char *name) |
bool | has_int (HSQUIRRELVM vm, const char *name) |
bool | has_string (HSQUIRRELVM vm, const char *name) |
bool | has_bool (HSQUIRRELVM vm, const char *name) |
float | read_float (HSQUIRRELVM vm, const char *name) |
int | read_int (HSQUIRRELVM vm, const char *name) |
std::string | read_string (HSQUIRRELVM vm, const char *name) |
bool | read_bool (HSQUIRRELVM vm, const char *name) |
bool | get_float (HSQUIRRELVM vm, const char *name, float &val) |
bool | get_int (HSQUIRRELVM vm, const char *name, int &val) |
bool | get_string (HSQUIRRELVM vm, const char *name, std::string &val) |
bool | get_bool (HSQUIRRELVM vm, const char *name, bool &val) |
template<typename T> | |
void | expose_object (HSQUIRRELVM v, SQInteger table_idx, T *object, const std::string &name, bool free=false) |
static void | unexpose_object (HSQUIRRELVM v, SQInteger table_idx, const std::string &name) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::AmbientSound *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Camera *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Candle *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::DisplayEffect *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::FloatingImage *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::LevelTime *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Platform *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Player *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::ScriptedObject *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::SSector *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Text *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Thunderstorm *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::TileMap *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::WillOWisp *object, bool setup_releasehook) |
void | create_squirrel_instance (HSQUIRRELVM v, scripting::Wind *object, bool setup_releasehook) |
void | register_supertux_wrapper (HSQUIRRELVM v) |
Variables | |
static const int | ANCHOR_TOP = 0x0010 |
static const int | ANCHOR_BOTTOM = 0x0020 |
static const int | ANCHOR_LEFT = 0x0001 |
static const int | ANCHOR_RIGHT = 0x0002 |
static const int | ANCHOR_MIDDLE = 0x0000 |
static const int | ANCHOR_TOP_LEFT = 0x0011 |
static const int | ANCHOR_TOP_RIGHT = 0x0012 |
static const int | ANCHOR_BOTTOM_LEFT = 0x0021 |
static const int | ANCHOR_BOTTOM_RIGHT = 0x0022 |
HSQUIRRELVM | global_vm = NULL |
HSQUIRRELVM | global_vm |
void scripting::abort_screenfade | ( | ) |
Aborts any kind of previous screen fade; the screenchange will happen anyway.
Definition at line 84 of file functions.cpp.
References g_screen_manager, and ScreenManager::set_screen_fade().
Referenced by scripting::wrapper::abort_screenfade_wrapper().
00085 { 00086 g_screen_manager->set_screen_fade(NULL); 00087 }
void scripting::camera | ( | ) |
show the camera's coordinates
Definition at line 268 of file functions.cpp.
References Sector::camera, Sector::current(), log_info, and validate_sector_player().
Referenced by scripting::wrapper::camera_wrapper(), Player::draw(), scripting::Camera::reload_config(), scripting::Camera::scroll_to(), scripting::Camera::set_mode(), scripting::Camera::shake(), SpriteParticle::update(), Particles::update(), and AmbientSound::update().
00269 { 00270 if (!validate_sector_player()) return; 00271 log_info << "Camera is at " << Sector::current()->camera->get_translation().x << "," << Sector::current()->camera->get_translation().y << std::endl; 00272 }
void scripting::compile_and_run | ( | HSQUIRRELVM | vm, | |
std::istream & | in, | |||
const std::string & | sourcename | |||
) |
Definition at line 326 of file squirrel_util.cpp.
References compile_script().
Referenced by init_squirrel(), Console::ready_vm(), World::run(), worldmap::WorldMap::run_script(), Sector::run_script(), and GameSession::run_script().
00328 { 00329 compile_script(vm, in, sourcename); 00330 00331 SQInteger oldtop = sq_gettop(vm); 00332 00333 try { 00334 sq_pushroottable(vm); 00335 if(SQ_FAILED(sq_call(vm, 1, SQFalse, SQTrue))) 00336 throw SquirrelError(vm, "Couldn't start script"); 00337 } catch(...) { 00338 sq_settop(vm, oldtop); 00339 throw; 00340 } 00341 00342 // we can remove the closure in case the script was not suspended 00343 if(sq_getvmstate(vm) != SQ_VMSTATE_SUSPENDED) { 00344 sq_settop(vm, oldtop-1); 00345 } 00346 }
void scripting::compile_script | ( | HSQUIRRELVM | vm, | |
std::istream & | in, | |||
const std::string & | sourcename | |||
) |
Definition at line 320 of file squirrel_util.cpp.
References squirrel_read_char().
Referenced by compile_and_run().
00321 { 00322 if(SQ_FAILED(sq_compile(vm, squirrel_read_char, &in, sourcename.c_str(), true))) 00323 throw SquirrelError(vm, "Couldn't parse script"); 00324 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Wind * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4220 of file wrapper.cpp.
References scripting::wrapper::Wind_release_hook().
04221 { 04222 using namespace wrapper; 04223 04224 sq_pushroottable(v); 04225 sq_pushstring(v, "Wind", -1); 04226 if(SQ_FAILED(sq_get(v, -2))) { 04227 std::ostringstream msg; 04228 msg << "Couldn't resolved squirrel type 'Wind'"; 04229 throw SquirrelError(v, msg.str()); 04230 } 04231 04232 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04233 std::ostringstream msg; 04234 msg << "Couldn't setup squirrel instance for object of type 'Wind'"; 04235 throw SquirrelError(v, msg.str()); 04236 } 04237 sq_remove(v, -2); // remove object name 04238 04239 if(setup_releasehook) { 04240 sq_setreleasehook(v, -1, Wind_release_hook); 04241 } 04242 04243 sq_remove(v, -2); // remove root table 04244 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::WillOWisp * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4194 of file wrapper.cpp.
References scripting::wrapper::WillOWisp_release_hook().
04195 { 04196 using namespace wrapper; 04197 04198 sq_pushroottable(v); 04199 sq_pushstring(v, "WillOWisp", -1); 04200 if(SQ_FAILED(sq_get(v, -2))) { 04201 std::ostringstream msg; 04202 msg << "Couldn't resolved squirrel type 'WillOWisp'"; 04203 throw SquirrelError(v, msg.str()); 04204 } 04205 04206 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04207 std::ostringstream msg; 04208 msg << "Couldn't setup squirrel instance for object of type 'WillOWisp'"; 04209 throw SquirrelError(v, msg.str()); 04210 } 04211 sq_remove(v, -2); // remove object name 04212 04213 if(setup_releasehook) { 04214 sq_setreleasehook(v, -1, WillOWisp_release_hook); 04215 } 04216 04217 sq_remove(v, -2); // remove root table 04218 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::TileMap * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4168 of file wrapper.cpp.
References scripting::wrapper::TileMap_release_hook().
04169 { 04170 using namespace wrapper; 04171 04172 sq_pushroottable(v); 04173 sq_pushstring(v, "TileMap", -1); 04174 if(SQ_FAILED(sq_get(v, -2))) { 04175 std::ostringstream msg; 04176 msg << "Couldn't resolved squirrel type 'TileMap'"; 04177 throw SquirrelError(v, msg.str()); 04178 } 04179 04180 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04181 std::ostringstream msg; 04182 msg << "Couldn't setup squirrel instance for object of type 'TileMap'"; 04183 throw SquirrelError(v, msg.str()); 04184 } 04185 sq_remove(v, -2); // remove object name 04186 04187 if(setup_releasehook) { 04188 sq_setreleasehook(v, -1, TileMap_release_hook); 04189 } 04190 04191 sq_remove(v, -2); // remove root table 04192 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Thunderstorm * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4142 of file wrapper.cpp.
References scripting::wrapper::Thunderstorm_release_hook().
04143 { 04144 using namespace wrapper; 04145 04146 sq_pushroottable(v); 04147 sq_pushstring(v, "Thunderstorm", -1); 04148 if(SQ_FAILED(sq_get(v, -2))) { 04149 std::ostringstream msg; 04150 msg << "Couldn't resolved squirrel type 'Thunderstorm'"; 04151 throw SquirrelError(v, msg.str()); 04152 } 04153 04154 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04155 std::ostringstream msg; 04156 msg << "Couldn't setup squirrel instance for object of type 'Thunderstorm'"; 04157 throw SquirrelError(v, msg.str()); 04158 } 04159 sq_remove(v, -2); // remove object name 04160 04161 if(setup_releasehook) { 04162 sq_setreleasehook(v, -1, Thunderstorm_release_hook); 04163 } 04164 04165 sq_remove(v, -2); // remove root table 04166 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Text * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4116 of file wrapper.cpp.
References scripting::wrapper::Text_release_hook().
04117 { 04118 using namespace wrapper; 04119 04120 sq_pushroottable(v); 04121 sq_pushstring(v, "Text", -1); 04122 if(SQ_FAILED(sq_get(v, -2))) { 04123 std::ostringstream msg; 04124 msg << "Couldn't resolved squirrel type 'Text'"; 04125 throw SquirrelError(v, msg.str()); 04126 } 04127 04128 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04129 std::ostringstream msg; 04130 msg << "Couldn't setup squirrel instance for object of type 'Text'"; 04131 throw SquirrelError(v, msg.str()); 04132 } 04133 sq_remove(v, -2); // remove object name 04134 04135 if(setup_releasehook) { 04136 sq_setreleasehook(v, -1, Text_release_hook); 04137 } 04138 04139 sq_remove(v, -2); // remove root table 04140 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::SSector * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4090 of file wrapper.cpp.
References scripting::wrapper::SSector_release_hook().
04091 { 04092 using namespace wrapper; 04093 04094 sq_pushroottable(v); 04095 sq_pushstring(v, "SSector", -1); 04096 if(SQ_FAILED(sq_get(v, -2))) { 04097 std::ostringstream msg; 04098 msg << "Couldn't resolved squirrel type 'SSector'"; 04099 throw SquirrelError(v, msg.str()); 04100 } 04101 04102 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04103 std::ostringstream msg; 04104 msg << "Couldn't setup squirrel instance for object of type 'SSector'"; 04105 throw SquirrelError(v, msg.str()); 04106 } 04107 sq_remove(v, -2); // remove object name 04108 04109 if(setup_releasehook) { 04110 sq_setreleasehook(v, -1, SSector_release_hook); 04111 } 04112 04113 sq_remove(v, -2); // remove root table 04114 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::ScriptedObject * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4064 of file wrapper.cpp.
References scripting::wrapper::ScriptedObject_release_hook().
04065 { 04066 using namespace wrapper; 04067 04068 sq_pushroottable(v); 04069 sq_pushstring(v, "ScriptedObject", -1); 04070 if(SQ_FAILED(sq_get(v, -2))) { 04071 std::ostringstream msg; 04072 msg << "Couldn't resolved squirrel type 'ScriptedObject'"; 04073 throw SquirrelError(v, msg.str()); 04074 } 04075 04076 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04077 std::ostringstream msg; 04078 msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'"; 04079 throw SquirrelError(v, msg.str()); 04080 } 04081 sq_remove(v, -2); // remove object name 04082 04083 if(setup_releasehook) { 04084 sq_setreleasehook(v, -1, ScriptedObject_release_hook); 04085 } 04086 04087 sq_remove(v, -2); // remove root table 04088 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Player * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4038 of file wrapper.cpp.
References scripting::wrapper::Player_release_hook().
04039 { 04040 using namespace wrapper; 04041 04042 sq_pushroottable(v); 04043 sq_pushstring(v, "Player", -1); 04044 if(SQ_FAILED(sq_get(v, -2))) { 04045 std::ostringstream msg; 04046 msg << "Couldn't resolved squirrel type 'Player'"; 04047 throw SquirrelError(v, msg.str()); 04048 } 04049 04050 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04051 std::ostringstream msg; 04052 msg << "Couldn't setup squirrel instance for object of type 'Player'"; 04053 throw SquirrelError(v, msg.str()); 04054 } 04055 sq_remove(v, -2); // remove object name 04056 04057 if(setup_releasehook) { 04058 sq_setreleasehook(v, -1, Player_release_hook); 04059 } 04060 04061 sq_remove(v, -2); // remove root table 04062 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Platform * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 4012 of file wrapper.cpp.
References scripting::wrapper::Platform_release_hook().
04013 { 04014 using namespace wrapper; 04015 04016 sq_pushroottable(v); 04017 sq_pushstring(v, "Platform", -1); 04018 if(SQ_FAILED(sq_get(v, -2))) { 04019 std::ostringstream msg; 04020 msg << "Couldn't resolved squirrel type 'Platform'"; 04021 throw SquirrelError(v, msg.str()); 04022 } 04023 04024 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 04025 std::ostringstream msg; 04026 msg << "Couldn't setup squirrel instance for object of type 'Platform'"; 04027 throw SquirrelError(v, msg.str()); 04028 } 04029 sq_remove(v, -2); // remove object name 04030 04031 if(setup_releasehook) { 04032 sq_setreleasehook(v, -1, Platform_release_hook); 04033 } 04034 04035 sq_remove(v, -2); // remove root table 04036 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::LevelTime * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 3986 of file wrapper.cpp.
References scripting::wrapper::LevelTime_release_hook().
03987 { 03988 using namespace wrapper; 03989 03990 sq_pushroottable(v); 03991 sq_pushstring(v, "LevelTime", -1); 03992 if(SQ_FAILED(sq_get(v, -2))) { 03993 std::ostringstream msg; 03994 msg << "Couldn't resolved squirrel type 'LevelTime'"; 03995 throw SquirrelError(v, msg.str()); 03996 } 03997 03998 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 03999 std::ostringstream msg; 04000 msg << "Couldn't setup squirrel instance for object of type 'LevelTime'"; 04001 throw SquirrelError(v, msg.str()); 04002 } 04003 sq_remove(v, -2); // remove object name 04004 04005 if(setup_releasehook) { 04006 sq_setreleasehook(v, -1, LevelTime_release_hook); 04007 } 04008 04009 sq_remove(v, -2); // remove root table 04010 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::FloatingImage * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 3960 of file wrapper.cpp.
References scripting::wrapper::FloatingImage_release_hook().
03961 { 03962 using namespace wrapper; 03963 03964 sq_pushroottable(v); 03965 sq_pushstring(v, "FloatingImage", -1); 03966 if(SQ_FAILED(sq_get(v, -2))) { 03967 std::ostringstream msg; 03968 msg << "Couldn't resolved squirrel type 'FloatingImage'"; 03969 throw SquirrelError(v, msg.str()); 03970 } 03971 03972 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 03973 std::ostringstream msg; 03974 msg << "Couldn't setup squirrel instance for object of type 'FloatingImage'"; 03975 throw SquirrelError(v, msg.str()); 03976 } 03977 sq_remove(v, -2); // remove object name 03978 03979 if(setup_releasehook) { 03980 sq_setreleasehook(v, -1, FloatingImage_release_hook); 03981 } 03982 03983 sq_remove(v, -2); // remove root table 03984 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::DisplayEffect * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 3934 of file wrapper.cpp.
References scripting::wrapper::DisplayEffect_release_hook().
03935 { 03936 using namespace wrapper; 03937 03938 sq_pushroottable(v); 03939 sq_pushstring(v, "DisplayEffect", -1); 03940 if(SQ_FAILED(sq_get(v, -2))) { 03941 std::ostringstream msg; 03942 msg << "Couldn't resolved squirrel type 'DisplayEffect'"; 03943 throw SquirrelError(v, msg.str()); 03944 } 03945 03946 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 03947 std::ostringstream msg; 03948 msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'"; 03949 throw SquirrelError(v, msg.str()); 03950 } 03951 sq_remove(v, -2); // remove object name 03952 03953 if(setup_releasehook) { 03954 sq_setreleasehook(v, -1, DisplayEffect_release_hook); 03955 } 03956 03957 sq_remove(v, -2); // remove root table 03958 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Candle * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 3908 of file wrapper.cpp.
References scripting::wrapper::Candle_release_hook().
03909 { 03910 using namespace wrapper; 03911 03912 sq_pushroottable(v); 03913 sq_pushstring(v, "Candle", -1); 03914 if(SQ_FAILED(sq_get(v, -2))) { 03915 std::ostringstream msg; 03916 msg << "Couldn't resolved squirrel type 'Candle'"; 03917 throw SquirrelError(v, msg.str()); 03918 } 03919 03920 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 03921 std::ostringstream msg; 03922 msg << "Couldn't setup squirrel instance for object of type 'Candle'"; 03923 throw SquirrelError(v, msg.str()); 03924 } 03925 sq_remove(v, -2); // remove object name 03926 03927 if(setup_releasehook) { 03928 sq_setreleasehook(v, -1, Candle_release_hook); 03929 } 03930 03931 sq_remove(v, -2); // remove root table 03932 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::Camera * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 3882 of file wrapper.cpp.
References scripting::wrapper::Camera_release_hook().
03883 { 03884 using namespace wrapper; 03885 03886 sq_pushroottable(v); 03887 sq_pushstring(v, "Camera", -1); 03888 if(SQ_FAILED(sq_get(v, -2))) { 03889 std::ostringstream msg; 03890 msg << "Couldn't resolved squirrel type 'Camera'"; 03891 throw SquirrelError(v, msg.str()); 03892 } 03893 03894 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 03895 std::ostringstream msg; 03896 msg << "Couldn't setup squirrel instance for object of type 'Camera'"; 03897 throw SquirrelError(v, msg.str()); 03898 } 03899 sq_remove(v, -2); // remove object name 03900 03901 if(setup_releasehook) { 03902 sq_setreleasehook(v, -1, Camera_release_hook); 03903 } 03904 03905 sq_remove(v, -2); // remove root table 03906 }
void scripting::create_squirrel_instance | ( | HSQUIRRELVM | v, | |
scripting::AmbientSound * | object, | |||
bool | setup_releasehook = false | |||
) |
Definition at line 3856 of file wrapper.cpp.
References scripting::wrapper::AmbientSound_release_hook().
Referenced by expose_object().
03857 { 03858 using namespace wrapper; 03859 03860 sq_pushroottable(v); 03861 sq_pushstring(v, "AmbientSound", -1); 03862 if(SQ_FAILED(sq_get(v, -2))) { 03863 std::ostringstream msg; 03864 msg << "Couldn't resolved squirrel type 'AmbientSound'"; 03865 throw SquirrelError(v, msg.str()); 03866 } 03867 03868 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) { 03869 std::ostringstream msg; 03870 msg << "Couldn't setup squirrel instance for object of type 'AmbientSound'"; 03871 throw SquirrelError(v, msg.str()); 03872 } 03873 sq_remove(v, -2); // remove object name 03874 03875 if(setup_releasehook) { 03876 sq_setreleasehook(v, -1, AmbientSound_release_hook); 03877 } 03878 03879 sq_remove(v, -2); // remove root table 03880 }
HSQOBJECT scripting::create_thread | ( | HSQUIRRELVM | vm | ) |
Definition at line 348 of file squirrel_util.cpp.
Referenced by World::run(), worldmap::WorldMap::run_script(), Sector::run_script(), and GameSession::run_script().
00349 { 00350 HSQUIRRELVM new_vm = sq_newthread(vm, 64); 00351 if(new_vm == NULL) 00352 throw SquirrelError(vm, "Couldn't create new VM"); 00353 00354 HSQOBJECT vm_object; 00355 sq_resetobject(&vm_object); 00356 if(SQ_FAILED(sq_getstackobj(vm, -1, &vm_object))) 00357 throw SquirrelError(vm, "Couldn't get squirrel thread from stack"); 00358 sq_addref(vm, &vm_object); 00359 00360 sq_pop(vm, 1); 00361 00362 return vm_object; 00363 }
void scripting::debug_collrects | ( | bool | enable | ) |
enable/disable drawing of collision rectangles
Definition at line 133 of file functions.cpp.
References Sector::show_collrects.
Referenced by scripting::wrapper::debug_collrects_wrapper().
00134 { 00135 Sector::show_collrects = enable; 00136 }
void scripting::debug_draw_editor_images | ( | bool | enable | ) |
enable/disable drawing of editor images
Definition at line 148 of file functions.cpp.
References Tile::draw_editor_images.
Referenced by scripting::wrapper::debug_draw_editor_images_wrapper().
00149 { 00150 Tile::draw_editor_images = enable; 00151 }
void scripting::debug_draw_solids_only | ( | bool | enable | ) |
enable/disable drawing of non-solid layers
Definition at line 143 of file functions.cpp.
References Sector::draw_solids_only.
Referenced by scripting::wrapper::debug_draw_solids_only_wrapper().
00144 { 00145 Sector::draw_solids_only = enable; 00146 }
void scripting::debug_show_fps | ( | bool | enable | ) |
enable/disable drawing of fps
Definition at line 138 of file functions.cpp.
References g_config, and Config::show_fps.
Referenced by scripting::wrapper::debug_show_fps_wrapper().
void scripting::debug_worldmap_ghost | ( | bool | enable | ) |
enable/disable worldmap ghost mode
Definition at line 153 of file functions.cpp.
Referenced by scripting::wrapper::debug_worldmap_ghost_wrapper().
00154 { 00155 using namespace worldmap; 00156 00157 if(WorldMap::current() == NULL) 00158 throw std::runtime_error("Can't change ghost mode without active WorldMap"); 00159 00160 WorldMap::current()->get_tux()->set_ghost_mode(enable); 00161 }
SQInteger scripting::display | ( | HSQUIRRELVM | vm | ) |
Display the value of the argument.
This is useful for inspecting tables.
Definition at line 42 of file functions.cpp.
References Console::output, and squirrel2string().
Referenced by scripting::wrapper::display_wrapper().
00043 { 00044 Console::output << squirrel2string(vm, -1) << std::endl; 00045 return 0; 00046 }
void scripting::display_text_file | ( | const std::string & | filename | ) |
Display a text file and scrolls it over the screen (on next screenswitch).
Definition at line 94 of file functions.cpp.
References g_screen_manager, and ScreenManager::push_screen().
Referenced by scripting::wrapper::display_text_file_wrapper().
00095 { 00096 g_screen_manager->push_screen(new TextScroller(filename)); 00097 }
void scripting::exit_screen | ( | ) |
Exits the currently running screen (force exit from worldmap or scrolling text for example).
Definition at line 69 of file functions.cpp.
References ScreenManager::exit_screen(), and g_screen_manager.
Referenced by scripting::wrapper::exit_screen_wrapper().
00070 { 00071 g_screen_manager->exit_screen(); 00072 }
void scripting::exit_squirrel | ( | ) |
Definition at line 106 of file squirrel_util.cpp.
References global_vm.
Referenced by Main::run().
00107 { 00108 #ifdef ENABLE_SQDBG 00109 if(debugger != NULL) { 00110 sq_rdbg_shutdown(debugger); 00111 debugger = NULL; 00112 } 00113 #endif 00114 00115 if (global_vm) 00116 sq_close(global_vm); 00117 00118 global_vm = NULL; 00119 }
void scripting::expose_object | ( | HSQUIRRELVM | v, | |
SQInteger | table_idx, | |||
T * | object, | |||
const std::string & | name, | |||
bool | free = false | |||
) |
Definition at line 48 of file squirrel_util.hpp.
References create_squirrel_instance().
Referenced by Wind::expose(), TileMap::expose(), Thunderstorm::expose(), TextObject::expose(), ScriptedObject::expose(), Player::expose(), Platform::expose(), LevelTime::expose(), DisplayEffect::expose(), Candle::expose(), Camera::expose(), AmbientSound::expose(), WillOWisp::expose(), and Sector::try_expose_me().
00050 { 00051 sq_pushstring(v, name.c_str(), -1); 00052 scripting::create_squirrel_instance(v, object, free); 00053 00054 if(table_idx < 0) 00055 table_idx -= 2; 00056 00057 // register instance in root table 00058 if(SQ_FAILED(sq_createslot(v, table_idx))) { 00059 std::ostringstream msg; 00060 msg << "Couldn't register object '" << name << "' in squirrel table"; 00061 throw scripting::SquirrelError(v, msg.str()); 00062 } 00063 }
void scripting::fadeout_screen | ( | float | seconds | ) |
Does a fadeout for the specified number of seconds before next screenchange.
Definition at line 74 of file functions.cpp.
References g_screen_manager, and ScreenManager::set_screen_fade().
Referenced by scripting::wrapper::fadeout_screen_wrapper().
00075 { 00076 g_screen_manager->set_screen_fade(new FadeOut(seconds)); 00077 }
bool scripting::get_bool | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
bool & | val | |||
) |
Definition at line 538 of file squirrel_util.cpp.
References has_bool(), and read_bool().
00538 { 00539 if (!has_bool(vm, name)) return false; 00540 val = read_bool(vm, name); 00541 return true; 00542 }
SQInteger scripting::get_current_thread | ( | HSQUIRRELVM | vm | ) |
returns the currently running thread
Definition at line 53 of file functions.cpp.
References vm_to_object().
Referenced by scripting::wrapper::get_current_thread_wrapper().
00054 { 00055 sq_pushobject(vm, vm_to_object(vm)); 00056 return 1; 00057 }
bool scripting::get_float | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
float & | val | |||
) |
Definition at line 520 of file squirrel_util.cpp.
References has_float(), and read_float().
Referenced by Statistics::unserialize_from_squirrel().
00520 { 00521 if (!has_float(vm, name)) return false; 00522 val = read_float(vm, name); 00523 return true; 00524 }
bool scripting::get_int | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
int & | val | |||
) |
Definition at line 526 of file squirrel_util.cpp.
References has_int(), and read_int().
Referenced by Statistics::unserialize_from_squirrel().
00526 { 00527 if (!has_int(vm, name)) return false; 00528 val = read_int(vm, name); 00529 return true; 00530 }
bool scripting::get_string | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
std::string & | val | |||
) |
Definition at line 532 of file squirrel_util.cpp.
References has_string(), and read_string().
00532 { 00533 if (!has_string(vm, name)) return false; 00534 val = read_string(vm, name); 00535 return true; 00536 }
void scripting::ghost | ( | ) |
makes Tux a ghost, i.e.
lets him float around and through solid objects
Definition at line 226 of file functions.cpp.
References Sector::current(), Sector::player, scripting::Player::set_ghost_mode(), and validate_sector_player().
Referenced by scripting::wrapper::ghost_wrapper().
00227 { 00228 if (!validate_sector_player()) return; 00229 ::Player* tux = Sector::current()->player; 00230 tux->set_ghost_mode(true); 00231 }
void scripting::gotoend | ( | ) |
move Tux near the end of the level
Definition at line 258 of file functions.cpp.
References Sector::camera, Sector::current(), Sector::player, SCREEN_WIDTH, and validate_sector_player().
Referenced by scripting::wrapper::gotoend_wrapper().
00259 { 00260 if (!validate_sector_player()) return; 00261 ::Player* tux = Sector::current()->player; 00262 tux->move(Vector( 00263 (Sector::current()->get_width()) - (SCREEN_WIDTH*2), 0)); 00264 Sector::current()->camera->reset( 00265 Vector(tux->get_pos().x, tux->get_pos().y)); 00266 }
void scripting::grease | ( | ) |
speeds Tux up
Definition at line 212 of file functions.cpp.
References Sector::current(), Sector::player, and validate_sector_player().
Referenced by scripting::wrapper::grease_wrapper().
00213 { 00214 if (!validate_sector_player()) return; 00215 ::Player* tux = Sector::current()->player; // scripting::Player != ::Player 00216 tux->get_physic().set_velocity_x(tux->get_physic().get_velocity_x()*3); 00217 }
bool scripting::has_bool | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 435 of file squirrel_util.cpp.
References has_float().
Referenced by get_bool().
00436 { 00437 return has_float(vm, name); 00438 }
bool scripting::has_float | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 417 of file squirrel_util.cpp.
Referenced by get_float(), has_bool(), has_int(), and has_string().
00418 { 00419 sq_pushstring(vm, name, -1); 00420 if (SQ_FAILED(sq_get(vm, -2))) return false; 00421 sq_pop(vm, 1); 00422 return true; 00423 }
bool scripting::has_int | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 425 of file squirrel_util.cpp.
References has_float().
Referenced by get_int().
00426 { 00427 return has_float(vm, name); 00428 }
bool scripting::has_string | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 430 of file squirrel_util.cpp.
References has_float().
Referenced by get_string().
00431 { 00432 return has_float(vm, name); 00433 }
void scripting::import | ( | HSQUIRRELVM | v, | |
const std::string & | filename | |||
) |
Load a script file and executes it.
This is typically used to import functions from external files.
Definition at line 117 of file functions.cpp.
References squirrel_read_char().
Referenced by scripting::wrapper::import_wrapper().
00118 { 00119 IFileStream in(filename); 00120 00121 if(SQ_FAILED(sq_compile(vm, squirrel_read_char, &in, 00122 filename.c_str(), SQTrue))) 00123 throw SquirrelError(vm, "Couldn't parse script"); 00124 00125 sq_pushroottable(vm); 00126 if(SQ_FAILED(sq_call(vm, 1, SQFalse, SQTrue))) { 00127 sq_pop(vm, 1); 00128 throw SquirrelError(vm, "Couldn't execute script"); 00129 } 00130 sq_pop(vm, 1); 00131 }
void scripting::init_squirrel | ( | bool | enable_debugger | ) |
Definition at line 51 of file squirrel_util.cpp.
References compile_and_run(), global_vm, log_info, log_warning, printfunc(), and register_supertux_wrapper().
Referenced by Main::run().
00052 { 00053 global_vm = sq_open(64); 00054 if(global_vm == NULL) 00055 throw std::runtime_error("Couldn't initialize squirrel vm"); 00056 00057 if(enable_debugger) { 00058 #ifdef ENABLE_SQDBG 00059 sq_enabledebuginfo(global_vm, SQTrue); 00060 debugger = sq_rdbg_init(global_vm, 1234, SQFalse); 00061 if(debugger == NULL) 00062 throw SquirrelError(global_vm, "Couldn't initialize squirrel debugger"); 00063 00064 sq_enabledebuginfo(global_vm, SQTrue); 00065 log_info << "Waiting for debug client..." << std::endl; 00066 if(SQ_FAILED(sq_rdbg_waitforconnections(debugger))) 00067 throw SquirrelError(global_vm, "Waiting for debug clients failed"); 00068 log_info << "debug client connected." << std::endl; 00069 #endif 00070 } 00071 00072 sq_pushroottable(global_vm); 00073 if(SQ_FAILED(sqstd_register_bloblib(global_vm))) 00074 throw SquirrelError(global_vm, "Couldn't register blob lib"); 00075 if(SQ_FAILED(sqstd_register_mathlib(global_vm))) 00076 throw SquirrelError(global_vm, "Couldn't register math lib"); 00077 if(SQ_FAILED(sqstd_register_stringlib(global_vm))) 00078 throw SquirrelError(global_vm, "Couldn't register string lib"); 00079 00080 // remove rand and srand calls from sqstdmath, we'll provide our own 00081 sq_pushstring(global_vm, "srand", -1); 00082 sq_deleteslot(global_vm, -2, SQFalse); 00083 sq_pushstring(global_vm, "rand", -1); 00084 sq_deleteslot(global_vm, -2, SQFalse); 00085 00086 // register supertux API 00087 register_supertux_wrapper(global_vm); 00088 00089 sq_pop(global_vm, 1); 00090 00091 // register print function 00092 sq_setprintfunc(global_vm, printfunc); 00093 // register default error handlers 00094 sqstd_seterrorhandlers(global_vm); 00095 00096 // try to load default script 00097 try { 00098 std::string filename = "scripts/default.nut"; 00099 IFileStream stream(filename); 00100 scripting::compile_and_run(global_vm, stream, filename); 00101 } catch(std::exception& e) { 00102 log_warning << "Couldn't load default.nut: " << e.what() << std::endl; 00103 } 00104 }
void scripting::invincible | ( | ) |
makes Tux invincible for 10000 units of time
Definition at line 219 of file functions.cpp.
References Sector::current(), Sector::player, and validate_sector_player().
Referenced by scripting::wrapper::invincible_wrapper().
00220 { 00221 if (!validate_sector_player()) return; 00222 ::Player* tux = Sector::current()->player; 00223 tux->invincible_timer.start(10000); 00224 }
void scripting::Level_edit | ( | bool | edit_mode | ) |
Switch to and from edit mode.
Definition at line 55 of file level.cpp.
References Currenton< GameSession >::current(), and GameSession::set_editmode().
Referenced by scripting::wrapper::Level_edit_wrapper().
00056 { 00057 if(GameSession::current() == NULL) return; 00058 GameSession::current()->set_editmode(edit_mode); 00059 }
void scripting::Level_finish | ( | bool | win | ) |
Instantly finish the currently played level.
Definition at line 22 of file level.cpp.
References Currenton< GameSession >::current(), and GameSession::finish().
Referenced by scripting::wrapper::Level_finish_wrapper().
00023 { 00024 if(GameSession::current() == NULL) 00025 return; 00026 00027 GameSession::current()->finish(win); 00028 }
void scripting::Level_flip_vertically | ( | ) |
Flip level vertically.
Definition at line 40 of file level.cpp.
References Currenton< GameSession >::current(), and LevelTransformer::transform().
Referenced by scripting::wrapper::Level_flip_vertically_wrapper().
00041 { 00042 FlipLevelTransformer flip_transformer; 00043 flip_transformer.transform(GameSession::current()->get_current_level()); 00044 }
void scripting::Level_spawn | ( | const std::string & | sector, | |
const std::string & | spawnpoint | |||
) |
spawn tux at specified sector and spawnpoint
Definition at line 31 of file level.cpp.
References Currenton< GameSession >::current(), and GameSession::respawn().
Referenced by scripting::wrapper::Level_spawn_wrapper().
00032 { 00033 if(GameSession::current() == NULL) 00034 return; 00035 00036 GameSession::current()->respawn(sector, spawnpoint); 00037 }
void scripting::Level_toggle_pause | ( | ) |
toggle pause
Definition at line 47 of file level.cpp.
References Currenton< GameSession >::current(), and GameSession::toggle_pause().
Referenced by scripting::wrapper::Level_toggle_pause_wrapper().
00048 { 00049 if(GameSession::current() == NULL) 00050 return; 00051 GameSession::current()->toggle_pause(); 00052 }
void scripting::load_level | ( | const std::string & | filename | ) |
Load and display a level (on next screenswitch).
Definition at line 109 of file functions.cpp.
References Currenton< GameSession >::current(), g_screen_manager, and ScreenManager::push_screen().
Referenced by scripting::wrapper::load_level_wrapper().
00110 { 00111 if(GameSession::current() == NULL) 00112 throw std::runtime_error("Can't start level without active level."); 00113 00114 g_screen_manager->push_screen(new GameSession(filename, GameSession::current()->get_player_status())); 00115 }
void scripting::load_squirrel_table | ( | HSQUIRRELVM | vm, | |
SQInteger | table_idx, | |||
const Reader & | lisp | |||
) |
Definition at line 27 of file serialize.cpp.
Referenced by World::load_state().
00028 { 00029 using namespace lisp; 00030 00031 if(table_idx < 0) 00032 table_idx -= 2; 00033 00034 lisp::ListIterator iter(&lisp); 00035 while(iter.next() && iter.lisp() != NULL) { 00036 const std::string& token = iter.item(); 00037 sq_pushstring(vm, token.c_str(), token.size()); 00038 00039 const lisp::Lisp* value = iter.value(); 00040 switch(value->get_type()) { 00041 case Lisp::TYPE_CONS: 00042 sq_newtable(vm); 00043 load_squirrel_table(vm, sq_gettop(vm), *iter.lisp()); 00044 break; 00045 case Lisp::TYPE_INTEGER: 00046 sq_pushinteger(vm, value->get_int()); 00047 break; 00048 case Lisp::TYPE_REAL: 00049 sq_pushfloat(vm, value->get_float()); 00050 break; 00051 case Lisp::TYPE_STRING: 00052 sq_pushstring(vm, value->get_string().c_str(), -1); 00053 break; 00054 case Lisp::TYPE_BOOLEAN: 00055 sq_pushbool(vm, value->get_bool() ? SQTrue : SQFalse); 00056 break; 00057 case Lisp::TYPE_SYMBOL: 00058 std::cerr << "Unexpected symbol in lisp file..."; 00059 sq_pushnull(vm); 00060 break; 00061 default: 00062 assert(false); 00063 break; 00064 } 00065 00066 if(SQ_FAILED(sq_createslot(vm, table_idx))) 00067 throw scripting::SquirrelError(vm, "Couldn't create new index"); 00068 } 00069 }
void scripting::load_worldmap | ( | const std::string & | filename | ) |
Load and display a worldmap (on next screenswitch).
Definition at line 99 of file functions.cpp.
References World::current(), g_screen_manager, and ScreenManager::push_screen().
Referenced by scripting::wrapper::load_worldmap_wrapper().
00100 { 00101 using namespace worldmap; 00102 00103 if(World::current() == NULL) 00104 throw std::runtime_error("Can't start WorldMap without active world."); 00105 00106 g_screen_manager->push_screen(new WorldMap(filename, World::current()->get_player_status())); 00107 }
void scripting::mortal | ( | ) |
recall Tux's invincibility and ghost status
Definition at line 233 of file functions.cpp.
References Sector::current(), Sector::player, scripting::Player::set_ghost_mode(), and validate_sector_player().
Referenced by scripting::wrapper::mortal_wrapper().
00234 { 00235 if (!validate_sector_player()) return; 00236 ::Player* tux = Sector::current()->player; 00237 tux->invincible_timer.stop(); 00238 tux->set_ghost_mode(false); 00239 }
HSQUIRRELVM scripting::object_to_vm | ( | HSQOBJECT | object | ) |
Definition at line 375 of file squirrel_util.cpp.
Referenced by World::run(), worldmap::WorldMap::run_script(), Sector::run_script(), and GameSession::run_script().
00376 { 00377 if(object._type != OT_THREAD) 00378 return NULL; 00379 00380 return object._unVal.pThread; 00381 }
void scripting::play_demo | ( | const std::string & | filename | ) |
Play back a demo from the given file.
Definition at line 304 of file functions.cpp.
References Currenton< GameSession >::current(), g_config, gameRandom, GameSession::get_demo_random_seed(), log_info, GameSession::play_demo(), Config::random_seed, GameSession::restart_level(), and RandomGenerator::srand().
Referenced by scripting::wrapper::play_demo_wrapper().
00305 { 00306 if (GameSession::current() == 0) 00307 { 00308 log_info << "No game session" << std::endl; 00309 return; 00310 } 00311 // Reset random seed 00312 g_config->random_seed = GameSession::current()->get_demo_random_seed(filename); 00313 g_config->random_seed = gameRandom.srand(g_config->random_seed); 00314 GameSession::current()->restart_level(); 00315 GameSession::current()->play_demo(filename); 00316 }
void scripting::play_music | ( | const std::string & | filename | ) |
Changes music to musicfile.
Definition at line 202 of file functions.cpp.
References SoundManager::play_music(), and sound_manager.
Referenced by scripting::wrapper::play_music_wrapper().
00203 { 00204 sound_manager->play_music(filename); 00205 }
void scripting::play_sound | ( | const std::string & | filename | ) |
Plays a soundfile.
Definition at line 207 of file functions.cpp.
References SoundManager::play(), and sound_manager.
Referenced by scripting::wrapper::play_sound_wrapper().
00208 { 00209 sound_manager->play(filename); 00210 }
void scripting::print_squirrel_stack | ( | HSQUIRRELVM | v | ) |
Definition at line 240 of file squirrel_util.cpp.
Referenced by print_stacktrace().
00241 { 00242 printf("--------------------------------------------------------------\n"); 00243 int count = sq_gettop(v); 00244 for(int i = 1; i <= count; ++i) { 00245 printf("%d: ",i); 00246 switch(sq_gettype(v, i)) 00247 { 00248 case OT_NULL: 00249 printf("null"); 00250 break; 00251 case OT_INTEGER: { 00252 SQInteger val; 00253 sq_getinteger(v, i, &val); 00254 printf("integer (%d)", static_cast<int> (val)); 00255 break; 00256 } 00257 case OT_FLOAT: { 00258 SQFloat val; 00259 sq_getfloat(v, i, &val); 00260 printf("float (%f)", val); 00261 break; 00262 } 00263 case OT_STRING: { 00264 const SQChar* val; 00265 sq_getstring(v, i, &val); 00266 printf("string (%s)", val); 00267 break; 00268 } 00269 case OT_TABLE: 00270 printf("table"); 00271 break; 00272 case OT_ARRAY: 00273 printf("array"); 00274 break; 00275 case OT_USERDATA: 00276 printf("userdata"); 00277 break; 00278 case OT_CLOSURE: 00279 printf("closure(function)"); 00280 break; 00281 case OT_NATIVECLOSURE: 00282 printf("native closure(C function)"); 00283 break; 00284 case OT_GENERATOR: 00285 printf("generator"); 00286 break; 00287 case OT_USERPOINTER: 00288 printf("userpointer"); 00289 break; 00290 case OT_THREAD: 00291 printf("thread"); 00292 break; 00293 case OT_CLASS: 00294 printf("class"); 00295 break; 00296 case OT_INSTANCE: 00297 printf("instance"); 00298 break; 00299 case OT_WEAKREF: 00300 printf("weakref"); 00301 break; 00302 default: 00303 printf("unknown?!?"); 00304 break; 00305 } 00306 printf("\n"); 00307 } 00308 printf("--------------------------------------------------------------\n"); 00309 }
void scripting::print_stacktrace | ( | HSQUIRRELVM | vm | ) |
Displays contents of the current stack.
Definition at line 48 of file functions.cpp.
References print_squirrel_stack().
Referenced by scripting::wrapper::print_stacktrace_wrapper().
00049 { 00050 print_squirrel_stack(vm); 00051 }
static void scripting::printfunc | ( | HSQUIRRELVM | , | |
const char * | str, | |||
... | ||||
) | [static] |
Definition at line 41 of file squirrel_util.cpp.
References Console::output.
Referenced by init_squirrel().
00042 { 00043 char buf[4096]; 00044 va_list arglist; 00045 va_start(arglist, str); 00046 vsprintf(buf, str, arglist); 00047 Console::output << (const char*) buf << std::flush; 00048 va_end(arglist); 00049 }
void scripting::quit | ( | ) |
exit the game
Definition at line 278 of file functions.cpp.
References g_screen_manager, and ScreenManager::quit().
Referenced by scripting::wrapper::quit_wrapper().
00279 { 00280 g_screen_manager->quit(); 00281 }
int scripting::rand | ( | ) |
Returns a random integer.
Definition at line 283 of file functions.cpp.
References gameRandom, and RandomGenerator::rand().
Referenced by scripting::wrapper::rand_wrapper().
00284 { 00285 return gameRandom.rand(); 00286 }
bool scripting::read_bool | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 500 of file squirrel_util.cpp.
Referenced by get_bool(), and worldmap::WorldMap::load_state().
00501 { 00502 sq_pushstring(vm, name, -1); 00503 if(SQ_FAILED(sq_get(vm, -2))) { 00504 std::ostringstream msg; 00505 msg << "Couldn't get bool value for '" << name << "' from table"; 00506 throw scripting::SquirrelError(vm, msg.str()); 00507 } 00508 00509 SQBool result; 00510 if(SQ_FAILED(sq_getbool(vm, -1, &result))) { 00511 std::ostringstream msg; 00512 msg << "Couldn't get bool value for '" << name << "' from table"; 00513 throw scripting::SquirrelError(vm, msg.str()); 00514 } 00515 sq_pop(vm, 1); 00516 00517 return result == SQTrue; 00518 }
float scripting::read_float | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 440 of file squirrel_util.cpp.
Referenced by get_float(), and worldmap::WorldMap::load_state().
00441 { 00442 sq_pushstring(vm, name, -1); 00443 if(SQ_FAILED(sq_get(vm, -2))) { 00444 std::ostringstream msg; 00445 msg << "Couldn't get float value for '" << name << "' from table"; 00446 throw scripting::SquirrelError(vm, msg.str()); 00447 } 00448 00449 float result; 00450 if(SQ_FAILED(sq_getfloat(vm, -1, &result))) { 00451 std::ostringstream msg; 00452 msg << "Couldn't get float value for '" << name << "' from table"; 00453 throw scripting::SquirrelError(vm, msg.str()); 00454 } 00455 sq_pop(vm, 1); 00456 00457 return result; 00458 }
int scripting::read_int | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 460 of file squirrel_util.cpp.
Referenced by get_int().
00461 { 00462 sq_pushstring(vm, name, -1); 00463 if(SQ_FAILED(sq_get(vm, -2))) { 00464 std::ostringstream msg; 00465 msg << "Couldn't get int value for '" << name << "' from table"; 00466 throw scripting::SquirrelError(vm, msg.str()); 00467 } 00468 00469 SQInteger result; 00470 if(SQ_FAILED(sq_getinteger(vm, -1, &result))) { 00471 std::ostringstream msg; 00472 msg << "Couldn't get int value for '" << name << "' from table"; 00473 throw scripting::SquirrelError(vm, msg.str()); 00474 } 00475 sq_pop(vm, 1); 00476 00477 return result; 00478 }
std::string scripting::read_string | ( | HSQUIRRELVM | vm, | |
const char * | name | |||
) |
Definition at line 480 of file squirrel_util.cpp.
Referenced by get_string(), and worldmap::WorldMap::load_state().
00481 { 00482 sq_pushstring(vm, name, -1); 00483 if(SQ_FAILED(sq_get(vm, -2))) { 00484 std::ostringstream msg; 00485 msg << "Couldn't get string value for '" << name << "' from table"; 00486 throw scripting::SquirrelError(vm, msg.str()); 00487 } 00488 00489 const char* result; 00490 if(SQ_FAILED(sq_getstring(vm, -1, &result))) { 00491 std::ostringstream msg; 00492 msg << "Couldn't get string value for '" << name << "' from table"; 00493 throw scripting::SquirrelError(vm, msg.str()); 00494 } 00495 sq_pop(vm, 1); 00496 00497 return std::string(result); 00498 }
void scripting::record_demo | ( | const std::string & | filename | ) |
Record a demo to the given file.
Definition at line 293 of file functions.cpp.
References Currenton< GameSession >::current(), log_info, GameSession::record_demo(), and GameSession::restart_level().
Referenced by scripting::wrapper::record_demo_wrapper().
00294 { 00295 if (GameSession::current() == 0) 00296 { 00297 log_info << "No game session" << std::endl; 00298 return; 00299 } 00300 GameSession::current()->restart_level(); 00301 GameSession::current()->record_demo(filename); 00302 }
void scripting::register_supertux_wrapper | ( | HSQUIRRELVM | v | ) |
Definition at line 4246 of file wrapper.cpp.
References scripting::wrapper::abort_screenfade_wrapper(), scripting::wrapper::AmbientSound_get_pos_x_wrapper(), scripting::wrapper::AmbientSound_get_pos_y_wrapper(), scripting::wrapper::AmbientSound_set_pos_wrapper(), scripting::wrapper::Camera_reload_config_wrapper(), scripting::wrapper::Camera_scroll_to_wrapper(), scripting::wrapper::Camera_set_mode_wrapper(), scripting::wrapper::Camera_set_pos_wrapper(), scripting::wrapper::Camera_shake_wrapper(), scripting::wrapper::camera_wrapper(), scripting::wrapper::Candle_get_burning_wrapper(), scripting::wrapper::Candle_set_burning_wrapper(), scripting::wrapper::debug_collrects_wrapper(), scripting::wrapper::debug_draw_editor_images_wrapper(), scripting::wrapper::debug_draw_solids_only_wrapper(), scripting::wrapper::debug_show_fps_wrapper(), scripting::wrapper::debug_worldmap_ghost_wrapper(), scripting::wrapper::display_text_file_wrapper(), scripting::wrapper::display_wrapper(), scripting::wrapper::DisplayEffect_fade_in_wrapper(), scripting::wrapper::DisplayEffect_fade_out_wrapper(), scripting::wrapper::DisplayEffect_four_to_three_wrapper(), scripting::wrapper::DisplayEffect_is_black_wrapper(), scripting::wrapper::DisplayEffect_set_black_wrapper(), scripting::wrapper::DisplayEffect_sixteen_to_nine_wrapper(), scripting::wrapper::exit_screen_wrapper(), scripting::wrapper::fadeout_screen_wrapper(), scripting::wrapper::FloatingImage_constructor_wrapper(), scripting::wrapper::FloatingImage_fade_in_wrapper(), scripting::wrapper::FloatingImage_fade_out_wrapper(), scripting::wrapper::FloatingImage_get_action_wrapper(), scripting::wrapper::FloatingImage_get_anchor_point_wrapper(), scripting::wrapper::FloatingImage_get_layer_wrapper(), scripting::wrapper::FloatingImage_get_pos_x_wrapper(), scripting::wrapper::FloatingImage_get_pos_y_wrapper(), scripting::wrapper::FloatingImage_get_visible_wrapper(), scripting::wrapper::FloatingImage_set_action_wrapper(), scripting::wrapper::FloatingImage_set_anchor_point_wrapper(), scripting::wrapper::FloatingImage_set_layer_wrapper(), scripting::wrapper::FloatingImage_set_pos_wrapper(), scripting::wrapper::FloatingImage_set_visible_wrapper(), scripting::wrapper::get_current_thread_wrapper(), scripting::wrapper::ghost_wrapper(), scripting::wrapper::gotoend_wrapper(), scripting::wrapper::grease_wrapper(), scripting::wrapper::import_wrapper(), scripting::wrapper::invincible_wrapper(), scripting::wrapper::Level_edit_wrapper(), scripting::wrapper::Level_finish_wrapper(), scripting::wrapper::Level_flip_vertically_wrapper(), scripting::wrapper::Level_spawn_wrapper(), scripting::wrapper::Level_toggle_pause_wrapper(), scripting::wrapper::LevelTime_get_time_wrapper(), scripting::wrapper::LevelTime_set_time_wrapper(), scripting::wrapper::LevelTime_start_wrapper(), scripting::wrapper::LevelTime_stop_wrapper(), scripting::wrapper::load_level_wrapper(), scripting::wrapper::load_worldmap_wrapper(), scripting::wrapper::mortal_wrapper(), scripting::wrapper::Platform_goto_node_wrapper(), scripting::wrapper::Platform_start_moving_wrapper(), scripting::wrapper::Platform_stop_moving_wrapper(), scripting::wrapper::play_demo_wrapper(), scripting::wrapper::play_music_wrapper(), scripting::wrapper::play_sound_wrapper(), scripting::wrapper::Player_activate_wrapper(), scripting::wrapper::Player_add_bonus_wrapper(), scripting::wrapper::Player_add_coins_wrapper(), scripting::wrapper::Player_deactivate_wrapper(), scripting::wrapper::Player_do_backflip_wrapper(), scripting::wrapper::Player_do_cheer_wrapper(), scripting::wrapper::Player_do_duck_wrapper(), scripting::wrapper::Player_do_jump_wrapper(), scripting::wrapper::Player_do_scripting_controller_wrapper(), scripting::wrapper::Player_do_standup_wrapper(), scripting::wrapper::Player_get_ghost_mode_wrapper(), scripting::wrapper::Player_get_visible_wrapper(), scripting::wrapper::Player_kill_wrapper(), scripting::wrapper::Player_make_invincible_wrapper(), scripting::wrapper::Player_set_ghost_mode_wrapper(), scripting::wrapper::Player_set_visible_wrapper(), scripting::wrapper::Player_trigger_sequence_wrapper(), scripting::wrapper::Player_use_scripting_controller_wrapper(), scripting::wrapper::Player_walk_wrapper(), scripting::wrapper::print_stacktrace_wrapper(), scripting::wrapper::quit_wrapper(), scripting::wrapper::rand_wrapper(), scripting::wrapper::record_demo_wrapper(), scripting::wrapper::restart_wrapper(), scripting::wrapper::save_state_wrapper(), scripting::wrapper::ScriptedObject_get_action_wrapper(), scripting::wrapper::ScriptedObject_get_name_wrapper(), scripting::wrapper::ScriptedObject_get_pos_x_wrapper(), scripting::wrapper::ScriptedObject_get_pos_y_wrapper(), scripting::wrapper::ScriptedObject_get_velocity_x_wrapper(), scripting::wrapper::ScriptedObject_get_velocity_y_wrapper(), scripting::wrapper::ScriptedObject_is_solid_wrapper(), scripting::wrapper::ScriptedObject_is_visible_wrapper(), scripting::wrapper::ScriptedObject_move_wrapper(), scripting::wrapper::ScriptedObject_set_action_wrapper(), scripting::wrapper::ScriptedObject_set_pos_wrapper(), scripting::wrapper::ScriptedObject_set_solid_wrapper(), scripting::wrapper::ScriptedObject_set_velocity_wrapper(), scripting::wrapper::ScriptedObject_set_visible_wrapper(), scripting::wrapper::set_game_speed_wrapper(), scripting::wrapper::set_gamma_wrapper(), scripting::wrapper::shrink_screen_wrapper(), scripting::wrapper::SSector_get_ambient_blue_wrapper(), scripting::wrapper::SSector_get_ambient_green_wrapper(), scripting::wrapper::SSector_get_ambient_red_wrapper(), scripting::wrapper::SSector_set_ambient_light_wrapper(), scripting::wrapper::SSector_set_gravity_wrapper(), scripting::wrapper::Text_fade_in_wrapper(), scripting::wrapper::Text_fade_out_wrapper(), scripting::wrapper::Text_get_anchor_point_wrapper(), scripting::wrapper::Text_get_pos_x_wrapper(), scripting::wrapper::Text_get_pos_y_wrapper(), scripting::wrapper::Text_set_anchor_point_wrapper(), scripting::wrapper::Text_set_centered_wrapper(), scripting::wrapper::Text_set_font_wrapper(), scripting::wrapper::Text_set_pos_wrapper(), scripting::wrapper::Text_set_text_wrapper(), scripting::wrapper::Text_set_visible_wrapper(), scripting::wrapper::Thunderstorm_electrify_wrapper(), scripting::wrapper::Thunderstorm_flash_wrapper(), scripting::wrapper::Thunderstorm_lightning_wrapper(), scripting::wrapper::Thunderstorm_start_wrapper(), scripting::wrapper::Thunderstorm_stop_wrapper(), scripting::wrapper::Thunderstorm_thunder_wrapper(), scripting::wrapper::TileMap_fade_wrapper(), scripting::wrapper::TileMap_get_alpha_wrapper(), scripting::wrapper::TileMap_goto_node_wrapper(), scripting::wrapper::TileMap_set_alpha_wrapper(), scripting::wrapper::TileMap_start_moving_wrapper(), scripting::wrapper::TileMap_stop_moving_wrapper(), scripting::wrapper::translate_wrapper(), scripting::wrapper::update_worldmap_wrapper(), scripting::wrapper::wait_for_screenswitch_wrapper(), scripting::wrapper::wait_wrapper(), scripting::wrapper::whereami_wrapper(), scripting::wrapper::WillOWisp_goto_node_wrapper(), scripting::wrapper::WillOWisp_set_state_wrapper(), scripting::wrapper::WillOWisp_start_moving_wrapper(), scripting::wrapper::WillOWisp_stop_moving_wrapper(), scripting::wrapper::Wind_start_wrapper(), and scripting::wrapper::Wind_stop_wrapper().
Referenced by init_squirrel().
04247 { 04248 using namespace wrapper; 04249 04250 sq_pushstring(v, "ANCHOR_TOP", -1); 04251 sq_pushinteger(v, 16); 04252 if(SQ_FAILED(sq_createslot(v, -3))) { 04253 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP'"); 04254 } 04255 04256 sq_pushstring(v, "ANCHOR_BOTTOM", -1); 04257 sq_pushinteger(v, 32); 04258 if(SQ_FAILED(sq_createslot(v, -3))) { 04259 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM'"); 04260 } 04261 04262 sq_pushstring(v, "ANCHOR_LEFT", -1); 04263 sq_pushinteger(v, 1); 04264 if(SQ_FAILED(sq_createslot(v, -3))) { 04265 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_LEFT'"); 04266 } 04267 04268 sq_pushstring(v, "ANCHOR_RIGHT", -1); 04269 sq_pushinteger(v, 2); 04270 if(SQ_FAILED(sq_createslot(v, -3))) { 04271 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_RIGHT'"); 04272 } 04273 04274 sq_pushstring(v, "ANCHOR_MIDDLE", -1); 04275 sq_pushinteger(v, 0); 04276 if(SQ_FAILED(sq_createslot(v, -3))) { 04277 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_MIDDLE'"); 04278 } 04279 04280 sq_pushstring(v, "ANCHOR_TOP_LEFT", -1); 04281 sq_pushinteger(v, 17); 04282 if(SQ_FAILED(sq_createslot(v, -3))) { 04283 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_LEFT'"); 04284 } 04285 04286 sq_pushstring(v, "ANCHOR_TOP_RIGHT", -1); 04287 sq_pushinteger(v, 18); 04288 if(SQ_FAILED(sq_createslot(v, -3))) { 04289 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_RIGHT'"); 04290 } 04291 04292 sq_pushstring(v, "ANCHOR_BOTTOM_LEFT", -1); 04293 sq_pushinteger(v, 33); 04294 if(SQ_FAILED(sq_createslot(v, -3))) { 04295 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_LEFT'"); 04296 } 04297 04298 sq_pushstring(v, "ANCHOR_BOTTOM_RIGHT", -1); 04299 sq_pushinteger(v, 34); 04300 if(SQ_FAILED(sq_createslot(v, -3))) { 04301 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_RIGHT'"); 04302 } 04303 04304 sq_pushstring(v, "display", -1); 04305 sq_newclosure(v, &display_wrapper, 0); 04306 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "t."); 04307 if(SQ_FAILED(sq_createslot(v, -3))) { 04308 throw SquirrelError(v, "Couldn't register function 'display'"); 04309 } 04310 04311 sq_pushstring(v, "print_stacktrace", -1); 04312 sq_newclosure(v, &print_stacktrace_wrapper, 0); 04313 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04314 if(SQ_FAILED(sq_createslot(v, -3))) { 04315 throw SquirrelError(v, "Couldn't register function 'print_stacktrace'"); 04316 } 04317 04318 sq_pushstring(v, "get_current_thread", -1); 04319 sq_newclosure(v, &get_current_thread_wrapper, 0); 04320 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "t"); 04321 if(SQ_FAILED(sq_createslot(v, -3))) { 04322 throw SquirrelError(v, "Couldn't register function 'get_current_thread'"); 04323 } 04324 04325 sq_pushstring(v, "display_text_file", -1); 04326 sq_newclosure(v, &display_text_file_wrapper, 0); 04327 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04328 if(SQ_FAILED(sq_createslot(v, -3))) { 04329 throw SquirrelError(v, "Couldn't register function 'display_text_file'"); 04330 } 04331 04332 sq_pushstring(v, "load_worldmap", -1); 04333 sq_newclosure(v, &load_worldmap_wrapper, 0); 04334 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04335 if(SQ_FAILED(sq_createslot(v, -3))) { 04336 throw SquirrelError(v, "Couldn't register function 'load_worldmap'"); 04337 } 04338 04339 sq_pushstring(v, "load_level", -1); 04340 sq_newclosure(v, &load_level_wrapper, 0); 04341 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04342 if(SQ_FAILED(sq_createslot(v, -3))) { 04343 throw SquirrelError(v, "Couldn't register function 'load_level'"); 04344 } 04345 04346 sq_pushstring(v, "wait", -1); 04347 sq_newclosure(v, &wait_wrapper, 0); 04348 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04349 if(SQ_FAILED(sq_createslot(v, -3))) { 04350 throw SquirrelError(v, "Couldn't register function 'wait'"); 04351 } 04352 04353 sq_pushstring(v, "wait_for_screenswitch", -1); 04354 sq_newclosure(v, &wait_for_screenswitch_wrapper, 0); 04355 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04356 if(SQ_FAILED(sq_createslot(v, -3))) { 04357 throw SquirrelError(v, "Couldn't register function 'wait_for_screenswitch'"); 04358 } 04359 04360 sq_pushstring(v, "exit_screen", -1); 04361 sq_newclosure(v, &exit_screen_wrapper, 0); 04362 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04363 if(SQ_FAILED(sq_createslot(v, -3))) { 04364 throw SquirrelError(v, "Couldn't register function 'exit_screen'"); 04365 } 04366 04367 sq_pushstring(v, "fadeout_screen", -1); 04368 sq_newclosure(v, &fadeout_screen_wrapper, 0); 04369 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04370 if(SQ_FAILED(sq_createslot(v, -3))) { 04371 throw SquirrelError(v, "Couldn't register function 'fadeout_screen'"); 04372 } 04373 04374 sq_pushstring(v, "shrink_screen", -1); 04375 sq_newclosure(v, &shrink_screen_wrapper, 0); 04376 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnnn"); 04377 if(SQ_FAILED(sq_createslot(v, -3))) { 04378 throw SquirrelError(v, "Couldn't register function 'shrink_screen'"); 04379 } 04380 04381 sq_pushstring(v, "abort_screenfade", -1); 04382 sq_newclosure(v, &abort_screenfade_wrapper, 0); 04383 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04384 if(SQ_FAILED(sq_createslot(v, -3))) { 04385 throw SquirrelError(v, "Couldn't register function 'abort_screenfade'"); 04386 } 04387 04388 sq_pushstring(v, "translate", -1); 04389 sq_newclosure(v, &translate_wrapper, 0); 04390 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04391 if(SQ_FAILED(sq_createslot(v, -3))) { 04392 throw SquirrelError(v, "Couldn't register function 'translate'"); 04393 } 04394 04395 sq_pushstring(v, "import", -1); 04396 sq_newclosure(v, &import_wrapper, 0); 04397 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04398 if(SQ_FAILED(sq_createslot(v, -3))) { 04399 throw SquirrelError(v, "Couldn't register function 'import'"); 04400 } 04401 04402 sq_pushstring(v, "save_state", -1); 04403 sq_newclosure(v, &save_state_wrapper, 0); 04404 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04405 if(SQ_FAILED(sq_createslot(v, -3))) { 04406 throw SquirrelError(v, "Couldn't register function 'save_state'"); 04407 } 04408 04409 sq_pushstring(v, "update_worldmap", -1); 04410 sq_newclosure(v, &update_worldmap_wrapper, 0); 04411 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04412 if(SQ_FAILED(sq_createslot(v, -3))) { 04413 throw SquirrelError(v, "Couldn't register function 'update_worldmap'"); 04414 } 04415 04416 sq_pushstring(v, "debug_collrects", -1); 04417 sq_newclosure(v, &debug_collrects_wrapper, 0); 04418 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04419 if(SQ_FAILED(sq_createslot(v, -3))) { 04420 throw SquirrelError(v, "Couldn't register function 'debug_collrects'"); 04421 } 04422 04423 sq_pushstring(v, "debug_show_fps", -1); 04424 sq_newclosure(v, &debug_show_fps_wrapper, 0); 04425 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04426 if(SQ_FAILED(sq_createslot(v, -3))) { 04427 throw SquirrelError(v, "Couldn't register function 'debug_show_fps'"); 04428 } 04429 04430 sq_pushstring(v, "debug_draw_solids_only", -1); 04431 sq_newclosure(v, &debug_draw_solids_only_wrapper, 0); 04432 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04433 if(SQ_FAILED(sq_createslot(v, -3))) { 04434 throw SquirrelError(v, "Couldn't register function 'debug_draw_solids_only'"); 04435 } 04436 04437 sq_pushstring(v, "debug_draw_editor_images", -1); 04438 sq_newclosure(v, &debug_draw_editor_images_wrapper, 0); 04439 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04440 if(SQ_FAILED(sq_createslot(v, -3))) { 04441 throw SquirrelError(v, "Couldn't register function 'debug_draw_editor_images'"); 04442 } 04443 04444 sq_pushstring(v, "debug_worldmap_ghost", -1); 04445 sq_newclosure(v, &debug_worldmap_ghost_wrapper, 0); 04446 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04447 if(SQ_FAILED(sq_createslot(v, -3))) { 04448 throw SquirrelError(v, "Couldn't register function 'debug_worldmap_ghost'"); 04449 } 04450 04451 sq_pushstring(v, "play_music", -1); 04452 sq_newclosure(v, &play_music_wrapper, 0); 04453 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04454 if(SQ_FAILED(sq_createslot(v, -3))) { 04455 throw SquirrelError(v, "Couldn't register function 'play_music'"); 04456 } 04457 04458 sq_pushstring(v, "play_sound", -1); 04459 sq_newclosure(v, &play_sound_wrapper, 0); 04460 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04461 if(SQ_FAILED(sq_createslot(v, -3))) { 04462 throw SquirrelError(v, "Couldn't register function 'play_sound'"); 04463 } 04464 04465 sq_pushstring(v, "set_game_speed", -1); 04466 sq_newclosure(v, &set_game_speed_wrapper, 0); 04467 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04468 if(SQ_FAILED(sq_createslot(v, -3))) { 04469 throw SquirrelError(v, "Couldn't register function 'set_game_speed'"); 04470 } 04471 04472 sq_pushstring(v, "grease", -1); 04473 sq_newclosure(v, &grease_wrapper, 0); 04474 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04475 if(SQ_FAILED(sq_createslot(v, -3))) { 04476 throw SquirrelError(v, "Couldn't register function 'grease'"); 04477 } 04478 04479 sq_pushstring(v, "invincible", -1); 04480 sq_newclosure(v, &invincible_wrapper, 0); 04481 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04482 if(SQ_FAILED(sq_createslot(v, -3))) { 04483 throw SquirrelError(v, "Couldn't register function 'invincible'"); 04484 } 04485 04486 sq_pushstring(v, "ghost", -1); 04487 sq_newclosure(v, &ghost_wrapper, 0); 04488 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04489 if(SQ_FAILED(sq_createslot(v, -3))) { 04490 throw SquirrelError(v, "Couldn't register function 'ghost'"); 04491 } 04492 04493 sq_pushstring(v, "mortal", -1); 04494 sq_newclosure(v, &mortal_wrapper, 0); 04495 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04496 if(SQ_FAILED(sq_createslot(v, -3))) { 04497 throw SquirrelError(v, "Couldn't register function 'mortal'"); 04498 } 04499 04500 sq_pushstring(v, "restart", -1); 04501 sq_newclosure(v, &restart_wrapper, 0); 04502 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04503 if(SQ_FAILED(sq_createslot(v, -3))) { 04504 throw SquirrelError(v, "Couldn't register function 'restart'"); 04505 } 04506 04507 sq_pushstring(v, "whereami", -1); 04508 sq_newclosure(v, &whereami_wrapper, 0); 04509 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04510 if(SQ_FAILED(sq_createslot(v, -3))) { 04511 throw SquirrelError(v, "Couldn't register function 'whereami'"); 04512 } 04513 04514 sq_pushstring(v, "gotoend", -1); 04515 sq_newclosure(v, &gotoend_wrapper, 0); 04516 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04517 if(SQ_FAILED(sq_createslot(v, -3))) { 04518 throw SquirrelError(v, "Couldn't register function 'gotoend'"); 04519 } 04520 04521 sq_pushstring(v, "camera", -1); 04522 sq_newclosure(v, &camera_wrapper, 0); 04523 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04524 if(SQ_FAILED(sq_createslot(v, -3))) { 04525 throw SquirrelError(v, "Couldn't register function 'camera'"); 04526 } 04527 04528 sq_pushstring(v, "set_gamma", -1); 04529 sq_newclosure(v, &set_gamma_wrapper, 0); 04530 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04531 if(SQ_FAILED(sq_createslot(v, -3))) { 04532 throw SquirrelError(v, "Couldn't register function 'set_gamma'"); 04533 } 04534 04535 sq_pushstring(v, "quit", -1); 04536 sq_newclosure(v, &quit_wrapper, 0); 04537 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04538 if(SQ_FAILED(sq_createslot(v, -3))) { 04539 throw SquirrelError(v, "Couldn't register function 'quit'"); 04540 } 04541 04542 sq_pushstring(v, "rand", -1); 04543 sq_newclosure(v, &rand_wrapper, 0); 04544 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04545 if(SQ_FAILED(sq_createslot(v, -3))) { 04546 throw SquirrelError(v, "Couldn't register function 'rand'"); 04547 } 04548 04549 sq_pushstring(v, "record_demo", -1); 04550 sq_newclosure(v, &record_demo_wrapper, 0); 04551 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04552 if(SQ_FAILED(sq_createslot(v, -3))) { 04553 throw SquirrelError(v, "Couldn't register function 'record_demo'"); 04554 } 04555 04556 sq_pushstring(v, "play_demo", -1); 04557 sq_newclosure(v, &play_demo_wrapper, 0); 04558 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04559 if(SQ_FAILED(sq_createslot(v, -3))) { 04560 throw SquirrelError(v, "Couldn't register function 'play_demo'"); 04561 } 04562 04563 sq_pushstring(v, "Level_finish", -1); 04564 sq_newclosure(v, &Level_finish_wrapper, 0); 04565 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04566 if(SQ_FAILED(sq_createslot(v, -3))) { 04567 throw SquirrelError(v, "Couldn't register function 'Level_finish'"); 04568 } 04569 04570 sq_pushstring(v, "Level_spawn", -1); 04571 sq_newclosure(v, &Level_spawn_wrapper, 0); 04572 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tss"); 04573 if(SQ_FAILED(sq_createslot(v, -3))) { 04574 throw SquirrelError(v, "Couldn't register function 'Level_spawn'"); 04575 } 04576 04577 sq_pushstring(v, "Level_flip_vertically", -1); 04578 sq_newclosure(v, &Level_flip_vertically_wrapper, 0); 04579 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04580 if(SQ_FAILED(sq_createslot(v, -3))) { 04581 throw SquirrelError(v, "Couldn't register function 'Level_flip_vertically'"); 04582 } 04583 04584 sq_pushstring(v, "Level_toggle_pause", -1); 04585 sq_newclosure(v, &Level_toggle_pause_wrapper, 0); 04586 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04587 if(SQ_FAILED(sq_createslot(v, -3))) { 04588 throw SquirrelError(v, "Couldn't register function 'Level_toggle_pause'"); 04589 } 04590 04591 sq_pushstring(v, "Level_edit", -1); 04592 sq_newclosure(v, &Level_edit_wrapper, 0); 04593 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04594 if(SQ_FAILED(sq_createslot(v, -3))) { 04595 throw SquirrelError(v, "Couldn't register function 'Level_edit'"); 04596 } 04597 04598 // Register class AmbientSound 04599 sq_pushstring(v, "AmbientSound", -1); 04600 if(sq_newclass(v, SQFalse) < 0) { 04601 std::ostringstream msg; 04602 msg << "Couldn't create new class 'AmbientSound'"; 04603 throw SquirrelError(v, msg.str()); 04604 } 04605 sq_pushstring(v, "set_pos", -1); 04606 sq_newclosure(v, &AmbientSound_set_pos_wrapper, 0); 04607 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 04608 if(SQ_FAILED(sq_createslot(v, -3))) { 04609 throw SquirrelError(v, "Couldn't register function 'set_pos'"); 04610 } 04611 04612 sq_pushstring(v, "get_pos_x", -1); 04613 sq_newclosure(v, &AmbientSound_get_pos_x_wrapper, 0); 04614 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04615 if(SQ_FAILED(sq_createslot(v, -3))) { 04616 throw SquirrelError(v, "Couldn't register function 'get_pos_x'"); 04617 } 04618 04619 sq_pushstring(v, "get_pos_y", -1); 04620 sq_newclosure(v, &AmbientSound_get_pos_y_wrapper, 0); 04621 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04622 if(SQ_FAILED(sq_createslot(v, -3))) { 04623 throw SquirrelError(v, "Couldn't register function 'get_pos_y'"); 04624 } 04625 04626 if(SQ_FAILED(sq_createslot(v, -3))) { 04627 throw SquirrelError(v, "Couldn't register class 'AmbientSound'"); 04628 } 04629 04630 // Register class Camera 04631 sq_pushstring(v, "Camera", -1); 04632 if(sq_newclass(v, SQFalse) < 0) { 04633 std::ostringstream msg; 04634 msg << "Couldn't create new class 'Camera'"; 04635 throw SquirrelError(v, msg.str()); 04636 } 04637 sq_pushstring(v, "reload_config", -1); 04638 sq_newclosure(v, &Camera_reload_config_wrapper, 0); 04639 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04640 if(SQ_FAILED(sq_createslot(v, -3))) { 04641 throw SquirrelError(v, "Couldn't register function 'reload_config'"); 04642 } 04643 04644 sq_pushstring(v, "shake", -1); 04645 sq_newclosure(v, &Camera_shake_wrapper, 0); 04646 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnnn"); 04647 if(SQ_FAILED(sq_createslot(v, -3))) { 04648 throw SquirrelError(v, "Couldn't register function 'shake'"); 04649 } 04650 04651 sq_pushstring(v, "set_pos", -1); 04652 sq_newclosure(v, &Camera_set_pos_wrapper, 0); 04653 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 04654 if(SQ_FAILED(sq_createslot(v, -3))) { 04655 throw SquirrelError(v, "Couldn't register function 'set_pos'"); 04656 } 04657 04658 sq_pushstring(v, "set_mode", -1); 04659 sq_newclosure(v, &Camera_set_mode_wrapper, 0); 04660 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04661 if(SQ_FAILED(sq_createslot(v, -3))) { 04662 throw SquirrelError(v, "Couldn't register function 'set_mode'"); 04663 } 04664 04665 sq_pushstring(v, "scroll_to", -1); 04666 sq_newclosure(v, &Camera_scroll_to_wrapper, 0); 04667 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnnn"); 04668 if(SQ_FAILED(sq_createslot(v, -3))) { 04669 throw SquirrelError(v, "Couldn't register function 'scroll_to'"); 04670 } 04671 04672 if(SQ_FAILED(sq_createslot(v, -3))) { 04673 throw SquirrelError(v, "Couldn't register class 'Camera'"); 04674 } 04675 04676 // Register class Candle 04677 sq_pushstring(v, "Candle", -1); 04678 if(sq_newclass(v, SQFalse) < 0) { 04679 std::ostringstream msg; 04680 msg << "Couldn't create new class 'Candle'"; 04681 throw SquirrelError(v, msg.str()); 04682 } 04683 sq_pushstring(v, "get_burning", -1); 04684 sq_newclosure(v, &Candle_get_burning_wrapper, 0); 04685 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04686 if(SQ_FAILED(sq_createslot(v, -3))) { 04687 throw SquirrelError(v, "Couldn't register function 'get_burning'"); 04688 } 04689 04690 sq_pushstring(v, "set_burning", -1); 04691 sq_newclosure(v, &Candle_set_burning_wrapper, 0); 04692 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04693 if(SQ_FAILED(sq_createslot(v, -3))) { 04694 throw SquirrelError(v, "Couldn't register function 'set_burning'"); 04695 } 04696 04697 if(SQ_FAILED(sq_createslot(v, -3))) { 04698 throw SquirrelError(v, "Couldn't register class 'Candle'"); 04699 } 04700 04701 // Register class DisplayEffect 04702 sq_pushstring(v, "DisplayEffect", -1); 04703 if(sq_newclass(v, SQFalse) < 0) { 04704 std::ostringstream msg; 04705 msg << "Couldn't create new class 'DisplayEffect'"; 04706 throw SquirrelError(v, msg.str()); 04707 } 04708 sq_pushstring(v, "fade_out", -1); 04709 sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0); 04710 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04711 if(SQ_FAILED(sq_createslot(v, -3))) { 04712 throw SquirrelError(v, "Couldn't register function 'fade_out'"); 04713 } 04714 04715 sq_pushstring(v, "fade_in", -1); 04716 sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0); 04717 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04718 if(SQ_FAILED(sq_createslot(v, -3))) { 04719 throw SquirrelError(v, "Couldn't register function 'fade_in'"); 04720 } 04721 04722 sq_pushstring(v, "set_black", -1); 04723 sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0); 04724 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04725 if(SQ_FAILED(sq_createslot(v, -3))) { 04726 throw SquirrelError(v, "Couldn't register function 'set_black'"); 04727 } 04728 04729 sq_pushstring(v, "is_black", -1); 04730 sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0); 04731 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04732 if(SQ_FAILED(sq_createslot(v, -3))) { 04733 throw SquirrelError(v, "Couldn't register function 'is_black'"); 04734 } 04735 04736 sq_pushstring(v, "sixteen_to_nine", -1); 04737 sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0); 04738 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04739 if(SQ_FAILED(sq_createslot(v, -3))) { 04740 throw SquirrelError(v, "Couldn't register function 'sixteen_to_nine'"); 04741 } 04742 04743 sq_pushstring(v, "four_to_three", -1); 04744 sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0); 04745 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04746 if(SQ_FAILED(sq_createslot(v, -3))) { 04747 throw SquirrelError(v, "Couldn't register function 'four_to_three'"); 04748 } 04749 04750 if(SQ_FAILED(sq_createslot(v, -3))) { 04751 throw SquirrelError(v, "Couldn't register class 'DisplayEffect'"); 04752 } 04753 04754 // Register class FloatingImage 04755 sq_pushstring(v, "FloatingImage", -1); 04756 if(sq_newclass(v, SQFalse) < 0) { 04757 std::ostringstream msg; 04758 msg << "Couldn't create new class 'FloatingImage'"; 04759 throw SquirrelError(v, msg.str()); 04760 } 04761 sq_pushstring(v, "constructor", -1); 04762 sq_newclosure(v, &FloatingImage_constructor_wrapper, 0); 04763 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04764 if(SQ_FAILED(sq_createslot(v, -3))) { 04765 throw SquirrelError(v, "Couldn't register function 'constructor'"); 04766 } 04767 04768 sq_pushstring(v, "set_layer", -1); 04769 sq_newclosure(v, &FloatingImage_set_layer_wrapper, 0); 04770 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 04771 if(SQ_FAILED(sq_createslot(v, -3))) { 04772 throw SquirrelError(v, "Couldn't register function 'set_layer'"); 04773 } 04774 04775 sq_pushstring(v, "get_layer", -1); 04776 sq_newclosure(v, &FloatingImage_get_layer_wrapper, 0); 04777 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04778 if(SQ_FAILED(sq_createslot(v, -3))) { 04779 throw SquirrelError(v, "Couldn't register function 'get_layer'"); 04780 } 04781 04782 sq_pushstring(v, "set_pos", -1); 04783 sq_newclosure(v, &FloatingImage_set_pos_wrapper, 0); 04784 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 04785 if(SQ_FAILED(sq_createslot(v, -3))) { 04786 throw SquirrelError(v, "Couldn't register function 'set_pos'"); 04787 } 04788 04789 sq_pushstring(v, "get_pos_x", -1); 04790 sq_newclosure(v, &FloatingImage_get_pos_x_wrapper, 0); 04791 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04792 if(SQ_FAILED(sq_createslot(v, -3))) { 04793 throw SquirrelError(v, "Couldn't register function 'get_pos_x'"); 04794 } 04795 04796 sq_pushstring(v, "get_pos_y", -1); 04797 sq_newclosure(v, &FloatingImage_get_pos_y_wrapper, 0); 04798 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04799 if(SQ_FAILED(sq_createslot(v, -3))) { 04800 throw SquirrelError(v, "Couldn't register function 'get_pos_y'"); 04801 } 04802 04803 sq_pushstring(v, "set_anchor_point", -1); 04804 sq_newclosure(v, &FloatingImage_set_anchor_point_wrapper, 0); 04805 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 04806 if(SQ_FAILED(sq_createslot(v, -3))) { 04807 throw SquirrelError(v, "Couldn't register function 'set_anchor_point'"); 04808 } 04809 04810 sq_pushstring(v, "get_anchor_point", -1); 04811 sq_newclosure(v, &FloatingImage_get_anchor_point_wrapper, 0); 04812 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04813 if(SQ_FAILED(sq_createslot(v, -3))) { 04814 throw SquirrelError(v, "Couldn't register function 'get_anchor_point'"); 04815 } 04816 04817 sq_pushstring(v, "set_visible", -1); 04818 sq_newclosure(v, &FloatingImage_set_visible_wrapper, 0); 04819 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04820 if(SQ_FAILED(sq_createslot(v, -3))) { 04821 throw SquirrelError(v, "Couldn't register function 'set_visible'"); 04822 } 04823 04824 sq_pushstring(v, "get_visible", -1); 04825 sq_newclosure(v, &FloatingImage_get_visible_wrapper, 0); 04826 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04827 if(SQ_FAILED(sq_createslot(v, -3))) { 04828 throw SquirrelError(v, "Couldn't register function 'get_visible'"); 04829 } 04830 04831 sq_pushstring(v, "set_action", -1); 04832 sq_newclosure(v, &FloatingImage_set_action_wrapper, 0); 04833 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04834 if(SQ_FAILED(sq_createslot(v, -3))) { 04835 throw SquirrelError(v, "Couldn't register function 'set_action'"); 04836 } 04837 04838 sq_pushstring(v, "get_action", -1); 04839 sq_newclosure(v, &FloatingImage_get_action_wrapper, 0); 04840 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04841 if(SQ_FAILED(sq_createslot(v, -3))) { 04842 throw SquirrelError(v, "Couldn't register function 'get_action'"); 04843 } 04844 04845 sq_pushstring(v, "fade_in", -1); 04846 sq_newclosure(v, &FloatingImage_fade_in_wrapper, 0); 04847 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04848 if(SQ_FAILED(sq_createslot(v, -3))) { 04849 throw SquirrelError(v, "Couldn't register function 'fade_in'"); 04850 } 04851 04852 sq_pushstring(v, "fade_out", -1); 04853 sq_newclosure(v, &FloatingImage_fade_out_wrapper, 0); 04854 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04855 if(SQ_FAILED(sq_createslot(v, -3))) { 04856 throw SquirrelError(v, "Couldn't register function 'fade_out'"); 04857 } 04858 04859 if(SQ_FAILED(sq_createslot(v, -3))) { 04860 throw SquirrelError(v, "Couldn't register class 'FloatingImage'"); 04861 } 04862 04863 // Register class LevelTime 04864 sq_pushstring(v, "LevelTime", -1); 04865 if(sq_newclass(v, SQFalse) < 0) { 04866 std::ostringstream msg; 04867 msg << "Couldn't create new class 'LevelTime'"; 04868 throw SquirrelError(v, msg.str()); 04869 } 04870 sq_pushstring(v, "start", -1); 04871 sq_newclosure(v, &LevelTime_start_wrapper, 0); 04872 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04873 if(SQ_FAILED(sq_createslot(v, -3))) { 04874 throw SquirrelError(v, "Couldn't register function 'start'"); 04875 } 04876 04877 sq_pushstring(v, "stop", -1); 04878 sq_newclosure(v, &LevelTime_stop_wrapper, 0); 04879 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04880 if(SQ_FAILED(sq_createslot(v, -3))) { 04881 throw SquirrelError(v, "Couldn't register function 'stop'"); 04882 } 04883 04884 sq_pushstring(v, "get_time", -1); 04885 sq_newclosure(v, &LevelTime_get_time_wrapper, 0); 04886 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04887 if(SQ_FAILED(sq_createslot(v, -3))) { 04888 throw SquirrelError(v, "Couldn't register function 'get_time'"); 04889 } 04890 04891 sq_pushstring(v, "set_time", -1); 04892 sq_newclosure(v, &LevelTime_set_time_wrapper, 0); 04893 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04894 if(SQ_FAILED(sq_createslot(v, -3))) { 04895 throw SquirrelError(v, "Couldn't register function 'set_time'"); 04896 } 04897 04898 if(SQ_FAILED(sq_createslot(v, -3))) { 04899 throw SquirrelError(v, "Couldn't register class 'LevelTime'"); 04900 } 04901 04902 // Register class Platform 04903 sq_pushstring(v, "Platform", -1); 04904 if(sq_newclass(v, SQFalse) < 0) { 04905 std::ostringstream msg; 04906 msg << "Couldn't create new class 'Platform'"; 04907 throw SquirrelError(v, msg.str()); 04908 } 04909 sq_pushstring(v, "goto_node", -1); 04910 sq_newclosure(v, &Platform_goto_node_wrapper, 0); 04911 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 04912 if(SQ_FAILED(sq_createslot(v, -3))) { 04913 throw SquirrelError(v, "Couldn't register function 'goto_node'"); 04914 } 04915 04916 sq_pushstring(v, "start_moving", -1); 04917 sq_newclosure(v, &Platform_start_moving_wrapper, 0); 04918 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04919 if(SQ_FAILED(sq_createslot(v, -3))) { 04920 throw SquirrelError(v, "Couldn't register function 'start_moving'"); 04921 } 04922 04923 sq_pushstring(v, "stop_moving", -1); 04924 sq_newclosure(v, &Platform_stop_moving_wrapper, 0); 04925 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04926 if(SQ_FAILED(sq_createslot(v, -3))) { 04927 throw SquirrelError(v, "Couldn't register function 'stop_moving'"); 04928 } 04929 04930 if(SQ_FAILED(sq_createslot(v, -3))) { 04931 throw SquirrelError(v, "Couldn't register class 'Platform'"); 04932 } 04933 04934 // Register class Player 04935 sq_pushstring(v, "Player", -1); 04936 if(sq_newclass(v, SQFalse) < 0) { 04937 std::ostringstream msg; 04938 msg << "Couldn't create new class 'Player'"; 04939 throw SquirrelError(v, msg.str()); 04940 } 04941 sq_pushstring(v, "add_bonus", -1); 04942 sq_newclosure(v, &Player_add_bonus_wrapper, 0); 04943 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 04944 if(SQ_FAILED(sq_createslot(v, -3))) { 04945 throw SquirrelError(v, "Couldn't register function 'add_bonus'"); 04946 } 04947 04948 sq_pushstring(v, "add_coins", -1); 04949 sq_newclosure(v, &Player_add_coins_wrapper, 0); 04950 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 04951 if(SQ_FAILED(sq_createslot(v, -3))) { 04952 throw SquirrelError(v, "Couldn't register function 'add_coins'"); 04953 } 04954 04955 sq_pushstring(v, "make_invincible", -1); 04956 sq_newclosure(v, &Player_make_invincible_wrapper, 0); 04957 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04958 if(SQ_FAILED(sq_createslot(v, -3))) { 04959 throw SquirrelError(v, "Couldn't register function 'make_invincible'"); 04960 } 04961 04962 sq_pushstring(v, "deactivate", -1); 04963 sq_newclosure(v, &Player_deactivate_wrapper, 0); 04964 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04965 if(SQ_FAILED(sq_createslot(v, -3))) { 04966 throw SquirrelError(v, "Couldn't register function 'deactivate'"); 04967 } 04968 04969 sq_pushstring(v, "activate", -1); 04970 sq_newclosure(v, &Player_activate_wrapper, 0); 04971 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04972 if(SQ_FAILED(sq_createslot(v, -3))) { 04973 throw SquirrelError(v, "Couldn't register function 'activate'"); 04974 } 04975 04976 sq_pushstring(v, "walk", -1); 04977 sq_newclosure(v, &Player_walk_wrapper, 0); 04978 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 04979 if(SQ_FAILED(sq_createslot(v, -3))) { 04980 throw SquirrelError(v, "Couldn't register function 'walk'"); 04981 } 04982 04983 sq_pushstring(v, "set_visible", -1); 04984 sq_newclosure(v, &Player_set_visible_wrapper, 0); 04985 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 04986 if(SQ_FAILED(sq_createslot(v, -3))) { 04987 throw SquirrelError(v, "Couldn't register function 'set_visible'"); 04988 } 04989 04990 sq_pushstring(v, "get_visible", -1); 04991 sq_newclosure(v, &Player_get_visible_wrapper, 0); 04992 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 04993 if(SQ_FAILED(sq_createslot(v, -3))) { 04994 throw SquirrelError(v, "Couldn't register function 'get_visible'"); 04995 } 04996 04997 sq_pushstring(v, "kill", -1); 04998 sq_newclosure(v, &Player_kill_wrapper, 0); 04999 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05000 if(SQ_FAILED(sq_createslot(v, -3))) { 05001 throw SquirrelError(v, "Couldn't register function 'kill'"); 05002 } 05003 05004 sq_pushstring(v, "set_ghost_mode", -1); 05005 sq_newclosure(v, &Player_set_ghost_mode_wrapper, 0); 05006 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05007 if(SQ_FAILED(sq_createslot(v, -3))) { 05008 throw SquirrelError(v, "Couldn't register function 'set_ghost_mode'"); 05009 } 05010 05011 sq_pushstring(v, "get_ghost_mode", -1); 05012 sq_newclosure(v, &Player_get_ghost_mode_wrapper, 0); 05013 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05014 if(SQ_FAILED(sq_createslot(v, -3))) { 05015 throw SquirrelError(v, "Couldn't register function 'get_ghost_mode'"); 05016 } 05017 05018 sq_pushstring(v, "do_cheer", -1); 05019 sq_newclosure(v, &Player_do_cheer_wrapper, 0); 05020 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05021 if(SQ_FAILED(sq_createslot(v, -3))) { 05022 throw SquirrelError(v, "Couldn't register function 'do_cheer'"); 05023 } 05024 05025 sq_pushstring(v, "do_duck", -1); 05026 sq_newclosure(v, &Player_do_duck_wrapper, 0); 05027 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05028 if(SQ_FAILED(sq_createslot(v, -3))) { 05029 throw SquirrelError(v, "Couldn't register function 'do_duck'"); 05030 } 05031 05032 sq_pushstring(v, "do_standup", -1); 05033 sq_newclosure(v, &Player_do_standup_wrapper, 0); 05034 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05035 if(SQ_FAILED(sq_createslot(v, -3))) { 05036 throw SquirrelError(v, "Couldn't register function 'do_standup'"); 05037 } 05038 05039 sq_pushstring(v, "do_backflip", -1); 05040 sq_newclosure(v, &Player_do_backflip_wrapper, 0); 05041 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05042 if(SQ_FAILED(sq_createslot(v, -3))) { 05043 throw SquirrelError(v, "Couldn't register function 'do_backflip'"); 05044 } 05045 05046 sq_pushstring(v, "do_jump", -1); 05047 sq_newclosure(v, &Player_do_jump_wrapper, 0); 05048 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 05049 if(SQ_FAILED(sq_createslot(v, -3))) { 05050 throw SquirrelError(v, "Couldn't register function 'do_jump'"); 05051 } 05052 05053 sq_pushstring(v, "trigger_sequence", -1); 05054 sq_newclosure(v, &Player_trigger_sequence_wrapper, 0); 05055 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 05056 if(SQ_FAILED(sq_createslot(v, -3))) { 05057 throw SquirrelError(v, "Couldn't register function 'trigger_sequence'"); 05058 } 05059 05060 sq_pushstring(v, "use_scripting_controller", -1); 05061 sq_newclosure(v, &Player_use_scripting_controller_wrapper, 0); 05062 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05063 if(SQ_FAILED(sq_createslot(v, -3))) { 05064 throw SquirrelError(v, "Couldn't register function 'use_scripting_controller'"); 05065 } 05066 05067 sq_pushstring(v, "do_scripting_controller", -1); 05068 sq_newclosure(v, &Player_do_scripting_controller_wrapper, 0); 05069 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tsb"); 05070 if(SQ_FAILED(sq_createslot(v, -3))) { 05071 throw SquirrelError(v, "Couldn't register function 'do_scripting_controller'"); 05072 } 05073 05074 if(SQ_FAILED(sq_createslot(v, -3))) { 05075 throw SquirrelError(v, "Couldn't register class 'Player'"); 05076 } 05077 05078 // Register class ScriptedObject 05079 sq_pushstring(v, "ScriptedObject", -1); 05080 if(sq_newclass(v, SQFalse) < 0) { 05081 std::ostringstream msg; 05082 msg << "Couldn't create new class 'ScriptedObject'"; 05083 throw SquirrelError(v, msg.str()); 05084 } 05085 sq_pushstring(v, "set_action", -1); 05086 sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0); 05087 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 05088 if(SQ_FAILED(sq_createslot(v, -3))) { 05089 throw SquirrelError(v, "Couldn't register function 'set_action'"); 05090 } 05091 05092 sq_pushstring(v, "get_action", -1); 05093 sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0); 05094 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05095 if(SQ_FAILED(sq_createslot(v, -3))) { 05096 throw SquirrelError(v, "Couldn't register function 'get_action'"); 05097 } 05098 05099 sq_pushstring(v, "move", -1); 05100 sq_newclosure(v, &ScriptedObject_move_wrapper, 0); 05101 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 05102 if(SQ_FAILED(sq_createslot(v, -3))) { 05103 throw SquirrelError(v, "Couldn't register function 'move'"); 05104 } 05105 05106 sq_pushstring(v, "set_pos", -1); 05107 sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0); 05108 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 05109 if(SQ_FAILED(sq_createslot(v, -3))) { 05110 throw SquirrelError(v, "Couldn't register function 'set_pos'"); 05111 } 05112 05113 sq_pushstring(v, "get_pos_x", -1); 05114 sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0); 05115 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05116 if(SQ_FAILED(sq_createslot(v, -3))) { 05117 throw SquirrelError(v, "Couldn't register function 'get_pos_x'"); 05118 } 05119 05120 sq_pushstring(v, "get_pos_y", -1); 05121 sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0); 05122 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05123 if(SQ_FAILED(sq_createslot(v, -3))) { 05124 throw SquirrelError(v, "Couldn't register function 'get_pos_y'"); 05125 } 05126 05127 sq_pushstring(v, "set_velocity", -1); 05128 sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0); 05129 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 05130 if(SQ_FAILED(sq_createslot(v, -3))) { 05131 throw SquirrelError(v, "Couldn't register function 'set_velocity'"); 05132 } 05133 05134 sq_pushstring(v, "get_velocity_x", -1); 05135 sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0); 05136 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05137 if(SQ_FAILED(sq_createslot(v, -3))) { 05138 throw SquirrelError(v, "Couldn't register function 'get_velocity_x'"); 05139 } 05140 05141 sq_pushstring(v, "get_velocity_y", -1); 05142 sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0); 05143 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05144 if(SQ_FAILED(sq_createslot(v, -3))) { 05145 throw SquirrelError(v, "Couldn't register function 'get_velocity_y'"); 05146 } 05147 05148 sq_pushstring(v, "set_visible", -1); 05149 sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0); 05150 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05151 if(SQ_FAILED(sq_createslot(v, -3))) { 05152 throw SquirrelError(v, "Couldn't register function 'set_visible'"); 05153 } 05154 05155 sq_pushstring(v, "is_visible", -1); 05156 sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0); 05157 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05158 if(SQ_FAILED(sq_createslot(v, -3))) { 05159 throw SquirrelError(v, "Couldn't register function 'is_visible'"); 05160 } 05161 05162 sq_pushstring(v, "set_solid", -1); 05163 sq_newclosure(v, &ScriptedObject_set_solid_wrapper, 0); 05164 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05165 if(SQ_FAILED(sq_createslot(v, -3))) { 05166 throw SquirrelError(v, "Couldn't register function 'set_solid'"); 05167 } 05168 05169 sq_pushstring(v, "is_solid", -1); 05170 sq_newclosure(v, &ScriptedObject_is_solid_wrapper, 0); 05171 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05172 if(SQ_FAILED(sq_createslot(v, -3))) { 05173 throw SquirrelError(v, "Couldn't register function 'is_solid'"); 05174 } 05175 05176 sq_pushstring(v, "get_name", -1); 05177 sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0); 05178 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05179 if(SQ_FAILED(sq_createslot(v, -3))) { 05180 throw SquirrelError(v, "Couldn't register function 'get_name'"); 05181 } 05182 05183 if(SQ_FAILED(sq_createslot(v, -3))) { 05184 throw SquirrelError(v, "Couldn't register class 'ScriptedObject'"); 05185 } 05186 05187 // Register class SSector 05188 sq_pushstring(v, "SSector", -1); 05189 if(sq_newclass(v, SQFalse) < 0) { 05190 std::ostringstream msg; 05191 msg << "Couldn't create new class 'SSector'"; 05192 throw SquirrelError(v, msg.str()); 05193 } 05194 sq_pushstring(v, "set_ambient_light", -1); 05195 sq_newclosure(v, &SSector_set_ambient_light_wrapper, 0); 05196 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnnn"); 05197 if(SQ_FAILED(sq_createslot(v, -3))) { 05198 throw SquirrelError(v, "Couldn't register function 'set_ambient_light'"); 05199 } 05200 05201 sq_pushstring(v, "get_ambient_red", -1); 05202 sq_newclosure(v, &SSector_get_ambient_red_wrapper, 0); 05203 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05204 if(SQ_FAILED(sq_createslot(v, -3))) { 05205 throw SquirrelError(v, "Couldn't register function 'get_ambient_red'"); 05206 } 05207 05208 sq_pushstring(v, "get_ambient_green", -1); 05209 sq_newclosure(v, &SSector_get_ambient_green_wrapper, 0); 05210 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05211 if(SQ_FAILED(sq_createslot(v, -3))) { 05212 throw SquirrelError(v, "Couldn't register function 'get_ambient_green'"); 05213 } 05214 05215 sq_pushstring(v, "get_ambient_blue", -1); 05216 sq_newclosure(v, &SSector_get_ambient_blue_wrapper, 0); 05217 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05218 if(SQ_FAILED(sq_createslot(v, -3))) { 05219 throw SquirrelError(v, "Couldn't register function 'get_ambient_blue'"); 05220 } 05221 05222 sq_pushstring(v, "set_gravity", -1); 05223 sq_newclosure(v, &SSector_set_gravity_wrapper, 0); 05224 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 05225 if(SQ_FAILED(sq_createslot(v, -3))) { 05226 throw SquirrelError(v, "Couldn't register function 'set_gravity'"); 05227 } 05228 05229 if(SQ_FAILED(sq_createslot(v, -3))) { 05230 throw SquirrelError(v, "Couldn't register class 'SSector'"); 05231 } 05232 05233 // Register class Text 05234 sq_pushstring(v, "Text", -1); 05235 if(sq_newclass(v, SQFalse) < 0) { 05236 std::ostringstream msg; 05237 msg << "Couldn't create new class 'Text'"; 05238 throw SquirrelError(v, msg.str()); 05239 } 05240 sq_pushstring(v, "set_text", -1); 05241 sq_newclosure(v, &Text_set_text_wrapper, 0); 05242 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 05243 if(SQ_FAILED(sq_createslot(v, -3))) { 05244 throw SquirrelError(v, "Couldn't register function 'set_text'"); 05245 } 05246 05247 sq_pushstring(v, "set_font", -1); 05248 sq_newclosure(v, &Text_set_font_wrapper, 0); 05249 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 05250 if(SQ_FAILED(sq_createslot(v, -3))) { 05251 throw SquirrelError(v, "Couldn't register function 'set_font'"); 05252 } 05253 05254 sq_pushstring(v, "fade_in", -1); 05255 sq_newclosure(v, &Text_fade_in_wrapper, 0); 05256 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 05257 if(SQ_FAILED(sq_createslot(v, -3))) { 05258 throw SquirrelError(v, "Couldn't register function 'fade_in'"); 05259 } 05260 05261 sq_pushstring(v, "fade_out", -1); 05262 sq_newclosure(v, &Text_fade_out_wrapper, 0); 05263 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 05264 if(SQ_FAILED(sq_createslot(v, -3))) { 05265 throw SquirrelError(v, "Couldn't register function 'fade_out'"); 05266 } 05267 05268 sq_pushstring(v, "set_visible", -1); 05269 sq_newclosure(v, &Text_set_visible_wrapper, 0); 05270 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05271 if(SQ_FAILED(sq_createslot(v, -3))) { 05272 throw SquirrelError(v, "Couldn't register function 'set_visible'"); 05273 } 05274 05275 sq_pushstring(v, "set_centered", -1); 05276 sq_newclosure(v, &Text_set_centered_wrapper, 0); 05277 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tb"); 05278 if(SQ_FAILED(sq_createslot(v, -3))) { 05279 throw SquirrelError(v, "Couldn't register function 'set_centered'"); 05280 } 05281 05282 sq_pushstring(v, "set_pos", -1); 05283 sq_newclosure(v, &Text_set_pos_wrapper, 0); 05284 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 05285 if(SQ_FAILED(sq_createslot(v, -3))) { 05286 throw SquirrelError(v, "Couldn't register function 'set_pos'"); 05287 } 05288 05289 sq_pushstring(v, "get_pos_x", -1); 05290 sq_newclosure(v, &Text_get_pos_x_wrapper, 0); 05291 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05292 if(SQ_FAILED(sq_createslot(v, -3))) { 05293 throw SquirrelError(v, "Couldn't register function 'get_pos_x'"); 05294 } 05295 05296 sq_pushstring(v, "get_pos_y", -1); 05297 sq_newclosure(v, &Text_get_pos_y_wrapper, 0); 05298 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05299 if(SQ_FAILED(sq_createslot(v, -3))) { 05300 throw SquirrelError(v, "Couldn't register function 'get_pos_y'"); 05301 } 05302 05303 sq_pushstring(v, "set_anchor_point", -1); 05304 sq_newclosure(v, &Text_set_anchor_point_wrapper, 0); 05305 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 05306 if(SQ_FAILED(sq_createslot(v, -3))) { 05307 throw SquirrelError(v, "Couldn't register function 'set_anchor_point'"); 05308 } 05309 05310 sq_pushstring(v, "get_anchor_point", -1); 05311 sq_newclosure(v, &Text_get_anchor_point_wrapper, 0); 05312 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05313 if(SQ_FAILED(sq_createslot(v, -3))) { 05314 throw SquirrelError(v, "Couldn't register function 'get_anchor_point'"); 05315 } 05316 05317 if(SQ_FAILED(sq_createslot(v, -3))) { 05318 throw SquirrelError(v, "Couldn't register class 'Text'"); 05319 } 05320 05321 // Register class Thunderstorm 05322 sq_pushstring(v, "Thunderstorm", -1); 05323 if(sq_newclass(v, SQFalse) < 0) { 05324 std::ostringstream msg; 05325 msg << "Couldn't create new class 'Thunderstorm'"; 05326 throw SquirrelError(v, msg.str()); 05327 } 05328 sq_pushstring(v, "start", -1); 05329 sq_newclosure(v, &Thunderstorm_start_wrapper, 0); 05330 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05331 if(SQ_FAILED(sq_createslot(v, -3))) { 05332 throw SquirrelError(v, "Couldn't register function 'start'"); 05333 } 05334 05335 sq_pushstring(v, "stop", -1); 05336 sq_newclosure(v, &Thunderstorm_stop_wrapper, 0); 05337 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05338 if(SQ_FAILED(sq_createslot(v, -3))) { 05339 throw SquirrelError(v, "Couldn't register function 'stop'"); 05340 } 05341 05342 sq_pushstring(v, "thunder", -1); 05343 sq_newclosure(v, &Thunderstorm_thunder_wrapper, 0); 05344 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05345 if(SQ_FAILED(sq_createslot(v, -3))) { 05346 throw SquirrelError(v, "Couldn't register function 'thunder'"); 05347 } 05348 05349 sq_pushstring(v, "lightning", -1); 05350 sq_newclosure(v, &Thunderstorm_lightning_wrapper, 0); 05351 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05352 if(SQ_FAILED(sq_createslot(v, -3))) { 05353 throw SquirrelError(v, "Couldn't register function 'lightning'"); 05354 } 05355 05356 sq_pushstring(v, "flash", -1); 05357 sq_newclosure(v, &Thunderstorm_flash_wrapper, 0); 05358 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05359 if(SQ_FAILED(sq_createslot(v, -3))) { 05360 throw SquirrelError(v, "Couldn't register function 'flash'"); 05361 } 05362 05363 sq_pushstring(v, "electrify", -1); 05364 sq_newclosure(v, &Thunderstorm_electrify_wrapper, 0); 05365 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05366 if(SQ_FAILED(sq_createslot(v, -3))) { 05367 throw SquirrelError(v, "Couldn't register function 'electrify'"); 05368 } 05369 05370 if(SQ_FAILED(sq_createslot(v, -3))) { 05371 throw SquirrelError(v, "Couldn't register class 'Thunderstorm'"); 05372 } 05373 05374 // Register class TileMap 05375 sq_pushstring(v, "TileMap", -1); 05376 if(sq_newclass(v, SQFalse) < 0) { 05377 std::ostringstream msg; 05378 msg << "Couldn't create new class 'TileMap'"; 05379 throw SquirrelError(v, msg.str()); 05380 } 05381 sq_pushstring(v, "goto_node", -1); 05382 sq_newclosure(v, &TileMap_goto_node_wrapper, 0); 05383 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 05384 if(SQ_FAILED(sq_createslot(v, -3))) { 05385 throw SquirrelError(v, "Couldn't register function 'goto_node'"); 05386 } 05387 05388 sq_pushstring(v, "start_moving", -1); 05389 sq_newclosure(v, &TileMap_start_moving_wrapper, 0); 05390 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05391 if(SQ_FAILED(sq_createslot(v, -3))) { 05392 throw SquirrelError(v, "Couldn't register function 'start_moving'"); 05393 } 05394 05395 sq_pushstring(v, "stop_moving", -1); 05396 sq_newclosure(v, &TileMap_stop_moving_wrapper, 0); 05397 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05398 if(SQ_FAILED(sq_createslot(v, -3))) { 05399 throw SquirrelError(v, "Couldn't register function 'stop_moving'"); 05400 } 05401 05402 sq_pushstring(v, "fade", -1); 05403 sq_newclosure(v, &TileMap_fade_wrapper, 0); 05404 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tnn"); 05405 if(SQ_FAILED(sq_createslot(v, -3))) { 05406 throw SquirrelError(v, "Couldn't register function 'fade'"); 05407 } 05408 05409 sq_pushstring(v, "set_alpha", -1); 05410 sq_newclosure(v, &TileMap_set_alpha_wrapper, 0); 05411 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|tn"); 05412 if(SQ_FAILED(sq_createslot(v, -3))) { 05413 throw SquirrelError(v, "Couldn't register function 'set_alpha'"); 05414 } 05415 05416 sq_pushstring(v, "get_alpha", -1); 05417 sq_newclosure(v, &TileMap_get_alpha_wrapper, 0); 05418 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05419 if(SQ_FAILED(sq_createslot(v, -3))) { 05420 throw SquirrelError(v, "Couldn't register function 'get_alpha'"); 05421 } 05422 05423 if(SQ_FAILED(sq_createslot(v, -3))) { 05424 throw SquirrelError(v, "Couldn't register class 'TileMap'"); 05425 } 05426 05427 // Register class WillOWisp 05428 sq_pushstring(v, "WillOWisp", -1); 05429 if(sq_newclass(v, SQFalse) < 0) { 05430 std::ostringstream msg; 05431 msg << "Couldn't create new class 'WillOWisp'"; 05432 throw SquirrelError(v, msg.str()); 05433 } 05434 sq_pushstring(v, "goto_node", -1); 05435 sq_newclosure(v, &WillOWisp_goto_node_wrapper, 0); 05436 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ti"); 05437 if(SQ_FAILED(sq_createslot(v, -3))) { 05438 throw SquirrelError(v, "Couldn't register function 'goto_node'"); 05439 } 05440 05441 sq_pushstring(v, "set_state", -1); 05442 sq_newclosure(v, &WillOWisp_set_state_wrapper, 0); 05443 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|ts"); 05444 if(SQ_FAILED(sq_createslot(v, -3))) { 05445 throw SquirrelError(v, "Couldn't register function 'set_state'"); 05446 } 05447 05448 sq_pushstring(v, "start_moving", -1); 05449 sq_newclosure(v, &WillOWisp_start_moving_wrapper, 0); 05450 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05451 if(SQ_FAILED(sq_createslot(v, -3))) { 05452 throw SquirrelError(v, "Couldn't register function 'start_moving'"); 05453 } 05454 05455 sq_pushstring(v, "stop_moving", -1); 05456 sq_newclosure(v, &WillOWisp_stop_moving_wrapper, 0); 05457 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05458 if(SQ_FAILED(sq_createslot(v, -3))) { 05459 throw SquirrelError(v, "Couldn't register function 'stop_moving'"); 05460 } 05461 05462 if(SQ_FAILED(sq_createslot(v, -3))) { 05463 throw SquirrelError(v, "Couldn't register class 'WillOWisp'"); 05464 } 05465 05466 // Register class Wind 05467 sq_pushstring(v, "Wind", -1); 05468 if(sq_newclass(v, SQFalse) < 0) { 05469 std::ostringstream msg; 05470 msg << "Couldn't create new class 'Wind'"; 05471 throw SquirrelError(v, msg.str()); 05472 } 05473 sq_pushstring(v, "start", -1); 05474 sq_newclosure(v, &Wind_start_wrapper, 0); 05475 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05476 if(SQ_FAILED(sq_createslot(v, -3))) { 05477 throw SquirrelError(v, "Couldn't register function 'start'"); 05478 } 05479 05480 sq_pushstring(v, "stop", -1); 05481 sq_newclosure(v, &Wind_stop_wrapper, 0); 05482 sq_setparamscheck(v, SQ_MATCHTYPEMASKSTRING, "x|t"); 05483 if(SQ_FAILED(sq_createslot(v, -3))) { 05484 throw SquirrelError(v, "Couldn't register function 'stop'"); 05485 } 05486 05487 if(SQ_FAILED(sq_createslot(v, -3))) { 05488 throw SquirrelError(v, "Couldn't register class 'Wind'"); 05489 } 05490 05491 }
void scripting::restart | ( | ) |
reinitialise and respawn Tux at the beginning of the current level
Definition at line 241 of file functions.cpp.
References Currenton< GameSession >::current(), log_info, and GameSession::restart_level().
Referenced by scripting::wrapper::restart_wrapper().
00242 { 00243 if (GameSession::current() == 0) 00244 { 00245 log_info << "No game session" << std::endl; 00246 return; 00247 } 00248 GameSession::current()->restart_level(); 00249 }
void scripting::save_squirrel_table | ( | HSQUIRRELVM | vm, | |
SQInteger | table_idx, | |||
Writer & | writer | |||
) |
Definition at line 71 of file serialize.cpp.
References lisp::Writer::end_list(), lisp::Writer::start_list(), and lisp::Writer::write().
Referenced by World::save_state().
00072 { 00073 // offset because of sq_pushnull 00074 if(table_idx < 0) 00075 table_idx -= 1; 00076 00077 //iterator table 00078 sq_pushnull(vm); 00079 while(SQ_SUCCEEDED(sq_next(vm, table_idx))) { 00080 if(sq_gettype(vm, -2) != OT_STRING) { 00081 std::cerr << "Table contains non-string key\n"; 00082 continue; 00083 } 00084 const SQChar* key; 00085 sq_getstring(vm, -2, &key); 00086 00087 switch(sq_gettype(vm, -1)) { 00088 case OT_INTEGER: { 00089 SQInteger val; 00090 sq_getinteger(vm, -1, &val); 00091 writer.write(key, static_cast<int> (val)); 00092 break; 00093 } 00094 case OT_FLOAT: { 00095 SQFloat val; 00096 sq_getfloat(vm, -1, &val); 00097 writer.write(key, static_cast<float> (val)); 00098 break; 00099 } 00100 case OT_BOOL: { 00101 SQBool val; 00102 sq_getbool(vm, -1, &val); 00103 writer.write(key, val == SQTrue); 00104 break; 00105 } 00106 case OT_STRING: { 00107 const SQChar* str; 00108 sq_getstring(vm, -1, &str); 00109 writer.write(key, reinterpret_cast<const char*> (str)); 00110 break; 00111 } 00112 case OT_TABLE: { 00113 writer.start_list(key, true); 00114 save_squirrel_table(vm, -1, writer); 00115 writer.end_list(key); 00116 break; 00117 } 00118 case OT_CLOSURE: 00119 break; // ignore 00120 case OT_NATIVECLOSURE: 00121 break; 00122 default: 00123 std::cerr << "Can't serialize key '" << key << "' in table.\n"; 00124 break; 00125 } 00126 sq_pop(vm, 2); 00127 } 00128 sq_pop(vm, 1); 00129 }
void scripting::save_state | ( | ) |
Save world state to savegame.
Definition at line 163 of file functions.cpp.
References World::current(), and World::save_state().
Referenced by scripting::wrapper::save_state_wrapper().
00164 { 00165 using namespace worldmap; 00166 00167 if(World::current() == NULL || WorldMap::current() == NULL) 00168 throw std::runtime_error("Can't save state without active World"); 00169 00170 WorldMap::current()->save_state(); 00171 World::current()->save_state(); 00172 }
void scripting::set_game_speed | ( | float | speed | ) |
Set the game_speed.
Definition at line 288 of file functions.cpp.
References g_game_speed.
Referenced by scripting::wrapper::set_game_speed_wrapper().
00289 { 00290 ::g_game_speed = speed; 00291 }
void scripting::set_gamma | ( | float | gamma | ) |
adjust gamma
Definition at line 274 of file functions.cpp.
Referenced by scripting::wrapper::set_gamma_wrapper().
void scripting::shrink_screen | ( | float | dest_x, | |
float | dest_y, | |||
float | seconds | |||
) |
Does a shrinking fade towards the destposition for the specified number of seconds before next screenchange.
Definition at line 79 of file functions.cpp.
References g_screen_manager, and ScreenManager::set_screen_fade().
Referenced by scripting::wrapper::shrink_screen_wrapper().
00080 { 00081 g_screen_manager->set_screen_fade(new ShrinkFade(Vector(dest_x, dest_y), seconds)); 00082 }
std::string scripting::squirrel2string | ( | HSQUIRRELVM | v, | |
SQInteger | i | |||
) |
Definition at line 129 of file squirrel_util.cpp.
Referenced by display(), and Console::execute_script().
00130 { 00131 std::ostringstream os; 00132 switch(sq_gettype(v, i)) 00133 { 00134 case OT_NULL: 00135 os << "<null>"; 00136 break; 00137 case OT_BOOL: { 00138 SQBool p; 00139 sq_getbool(v, i, &p); 00140 if (p) 00141 os << "true"; 00142 else 00143 os << "false"; 00144 break; 00145 } 00146 case OT_INTEGER: { 00147 SQInteger val; 00148 sq_getinteger(v, i, &val); 00149 os << val; 00150 break; 00151 } 00152 case OT_FLOAT: { 00153 SQFloat val; 00154 sq_getfloat(v, i, &val); 00155 os << val; 00156 break; 00157 } 00158 case OT_STRING: { 00159 const SQChar* val; 00160 sq_getstring(v, i, &val); 00161 os << "\"" << val << "\""; 00162 break; 00163 } 00164 case OT_TABLE: { 00165 bool first = true; 00166 os << "{"; 00167 sq_pushnull(v); //null iterator 00168 while(SQ_SUCCEEDED(sq_next(v,i-1))) 00169 { 00170 if (!first) { 00171 os << ", "; 00172 } 00173 first = false; 00174 00175 //here -1 is the value and -2 is the key 00176 os << squirrel2string(v, -2) << " => " 00177 << squirrel2string(v, -1); 00178 00179 sq_pop(v,2); //pops key and val before the nex iteration 00180 } 00181 sq_pop(v, 1); 00182 os << "}"; 00183 break; 00184 } 00185 case OT_ARRAY: { 00186 bool first = true; 00187 os << "["; 00188 sq_pushnull(v); //null iterator 00189 while(SQ_SUCCEEDED(sq_next(v,i-1))) 00190 { 00191 if (!first) { 00192 os << ", "; 00193 } 00194 first = false; 00195 00196 //here -1 is the value and -2 is the key 00197 // we ignore the key, since that is just the index in an array 00198 os << squirrel2string(v, -1); 00199 00200 sq_pop(v,2); //pops key and val before the nex iteration 00201 } 00202 sq_pop(v, 1); 00203 os << "]"; 00204 break; 00205 } 00206 case OT_USERDATA: 00207 os << "<userdata>"; 00208 break; 00209 case OT_CLOSURE: 00210 os << "<closure>"; 00211 break; 00212 case OT_NATIVECLOSURE: 00213 os << "<native closure>"; 00214 break; 00215 case OT_GENERATOR: 00216 os << "<generator>"; 00217 break; 00218 case OT_USERPOINTER: 00219 os << "userpointer"; 00220 break; 00221 case OT_THREAD: 00222 os << "<thread>"; 00223 break; 00224 case OT_CLASS: 00225 os << "<class>"; 00226 break; 00227 case OT_INSTANCE: 00228 os << "<instance>"; 00229 break; 00230 case OT_WEAKREF: 00231 os << "<weakref>"; 00232 break; 00233 default: 00234 os << "<unknown>"; 00235 break; 00236 } 00237 return os.str(); 00238 }
SQInteger scripting::squirrel_read_char | ( | SQUserPointer | file | ) |
Definition at line 311 of file squirrel_util.cpp.
Referenced by compile_script(), and import().
00312 { 00313 std::istream* in = reinterpret_cast<std::istream*> (file); 00314 char c = in->get(); 00315 if(in->eof()) 00316 return 0; 00317 return c; 00318 }
void scripting::store_bool | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
bool | val | |||
) |
Definition at line 409 of file squirrel_util.cpp.
Referenced by worldmap::WorldMap::save_state().
00410 { 00411 sq_pushstring(vm, name, -1); 00412 sq_pushbool(vm, val ? SQTrue : SQFalse); 00413 if(SQ_FAILED(sq_createslot(vm, -3))) 00414 throw scripting::SquirrelError(vm, "Couldn't add float value to table"); 00415 }
void scripting::store_float | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
float | val | |||
) |
Definition at line 385 of file squirrel_util.cpp.
Referenced by worldmap::WorldMap::save_state(), and Statistics::serialize_to_squirrel().
00386 { 00387 sq_pushstring(vm, name, -1); 00388 sq_pushfloat(vm, val); 00389 if(SQ_FAILED(sq_createslot(vm, -3))) 00390 throw scripting::SquirrelError(vm, "Couldn't add float value to table"); 00391 }
void scripting::store_int | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
int | val | |||
) |
Definition at line 393 of file squirrel_util.cpp.
Referenced by Statistics::serialize_to_squirrel().
00394 { 00395 sq_pushstring(vm, name, -1); 00396 sq_pushinteger(vm, val); 00397 if(SQ_FAILED(sq_createslot(vm, -3))) 00398 throw scripting::SquirrelError(vm, "Couldn't add int value to table"); 00399 }
void scripting::store_string | ( | HSQUIRRELVM | vm, | |
const char * | name, | |||
const std::string & | val | |||
) |
Definition at line 401 of file squirrel_util.cpp.
Referenced by worldmap::WorldMap::save_state().
00402 { 00403 sq_pushstring(vm, name, -1); 00404 sq_pushstring(vm, val.c_str(), val.length()); 00405 if(SQ_FAILED(sq_createslot(vm, -3))) 00406 throw scripting::SquirrelError(vm, "Couldn't add float value to table"); 00407 }
std::string scripting::translate | ( | const std::string & | text | ) |
Translate a text into the users language (by looking it up in the .po files).
Definition at line 89 of file functions.cpp.
References dictionary_manager.
Referenced by scripting::wrapper::translate_wrapper().
00090 { 00091 return dictionary_manager->get_dictionary().translate(text); 00092 }
static void scripting::unexpose_object | ( | HSQUIRRELVM | v, | |
SQInteger | table_idx, | |||
const std::string & | name | |||
) | [inline, static] |
Definition at line 65 of file squirrel_util.hpp.
Referenced by Sector::try_unexpose_me(), Wind::unexpose(), TileMap::unexpose(), Thunderstorm::unexpose(), TextObject::unexpose(), ScriptedObject::unexpose(), Player::unexpose(), Platform::unexpose(), LevelTime::unexpose(), DisplayEffect::unexpose(), Candle::unexpose(), Camera::unexpose(), AmbientSound::unexpose(), and WillOWisp::unexpose().
00067 { 00068 sq_pushstring(v, name.c_str(), name.length()); 00069 00070 if(table_idx < 0) 00071 table_idx -= 1; 00072 00073 if(SQ_FAILED(sq_deleteslot(v, table_idx, SQFalse))) { 00074 std::ostringstream msg; 00075 msg << "Couldn't unregister object '" << name << "' in squirrel root table"; 00076 throw scripting::SquirrelError(v, msg.str()); 00077 } 00078 }
void scripting::update_debugger | ( | ) |
Definition at line 121 of file squirrel_util.cpp.
Referenced by ScreenManager::update_gamelogic().
00122 { 00123 #ifdef ENABLE_SQDBG 00124 if(debugger != NULL) 00125 sq_rdbg_update(debugger); 00126 #endif 00127 }
void scripting::update_worldmap | ( | ) |
Update worldmap from worldmap state (state.world variable).
Definition at line 174 of file functions.cpp.
Referenced by scripting::wrapper::update_worldmap_wrapper().
00175 { 00176 using namespace worldmap; 00177 00178 if(WorldMap::current() == NULL) 00179 throw std::runtime_error("Can't update Worldmap: none active"); 00180 00181 WorldMap::current()->load_state(); 00182 }
bool scripting::validate_sector_player | ( | ) |
Definition at line 186 of file functions.cpp.
References Sector::current(), and log_info.
Referenced by camera(), ghost(), gotoend(), grease(), invincible(), mortal(), and whereami().
00187 { 00188 if (Sector::current() == 0) 00189 { 00190 log_info << "No current sector." << std::endl; 00191 return false; 00192 } 00193 00194 if (Sector::current()->player == 0) 00195 { 00196 log_info << "No player." << std::endl; 00197 return false; 00198 } 00199 return true; 00200 }
SQObject scripting::vm_to_object | ( | HSQUIRRELVM | vm | ) |
Definition at line 365 of file squirrel_util.cpp.
Referenced by scripting::ThreadQueue::add(), get_current_thread(), and scripting::TimeScheduler::schedule_thread().
00366 { 00367 HSQOBJECT object; 00368 sq_resetobject(&object); 00369 object._unVal.pThread = vm; 00370 object._type = OT_THREAD; 00371 00372 return object; 00373 }
void scripting::wait | ( | HSQUIRRELVM | vm, | |
float | seconds | |||
) |
Suspend the script execution for the specified number of seconds.
Definition at line 59 of file functions.cpp.
References game_time, scripting::TimeScheduler::instance, and scripting::TimeScheduler::schedule_thread().
Referenced by scripting::wrapper::wait_wrapper().
00060 { 00061 TimeScheduler::instance->schedule_thread(vm, game_time + seconds); 00062 }
void scripting::wait_for_screenswitch | ( | HSQUIRRELVM | vm | ) |
Suspend the script execution until the current screen has been changed.
Definition at line 64 of file functions.cpp.
References scripting::ThreadQueue::add(), g_screen_manager, and ScreenManager::waiting_threads.
Referenced by scripting::wrapper::wait_for_screenswitch_wrapper().
00065 { 00066 g_screen_manager->waiting_threads.add(vm); 00067 }
void scripting::whereami | ( | ) |
print Tux's current coordinates in a level
Definition at line 251 of file functions.cpp.
References Sector::current(), log_info, Sector::player, and validate_sector_player().
Referenced by scripting::wrapper::whereami_wrapper().
00252 { 00253 if (!validate_sector_player()) return; 00254 ::Player* tux = Sector::current()->player; 00255 log_info << "You are at x " << ((int) tux->get_pos().x) << ", y " << ((int) tux->get_pos().y) << std::endl; 00256 }
const int scripting::ANCHOR_BOTTOM = 0x0020 [static] |
Definition at line 24 of file anchor_points.hpp.
const int scripting::ANCHOR_BOTTOM_LEFT = 0x0021 [static] |
Definition at line 30 of file anchor_points.hpp.
const int scripting::ANCHOR_BOTTOM_RIGHT = 0x0022 [static] |
Definition at line 31 of file anchor_points.hpp.
const int scripting::ANCHOR_LEFT = 0x0001 [static] |
Definition at line 25 of file anchor_points.hpp.
const int scripting::ANCHOR_MIDDLE = 0x0000 [static] |
Definition at line 27 of file anchor_points.hpp.
const int scripting::ANCHOR_RIGHT = 0x0002 [static] |
Definition at line 26 of file anchor_points.hpp.
const int scripting::ANCHOR_TOP = 0x0010 [static] |
Definition at line 23 of file anchor_points.hpp.
const int scripting::ANCHOR_TOP_LEFT = 0x0011 [static] |
Definition at line 28 of file anchor_points.hpp.
const int scripting::ANCHOR_TOP_RIGHT = 0x0012 [static] |
Definition at line 29 of file anchor_points.hpp.
HSQUIRRELVM scripting::global_vm |
Definition at line 39 of file squirrel_util.cpp.
Referenced by Sector::activate(), scripting::ThreadQueue::add(), Sector::deactivate(), exit_squirrel(), init_squirrel(), worldmap::WorldMap::leave(), worldmap::WorldMap::load_state(), World::load_state(), Console::ready_vm(), World::run(), worldmap::WorldMap::run_script(), Sector::run_script(), GameSession::run_script(), worldmap::WorldMap::save_state(), World::save_state(), scripting::TimeScheduler::schedule_thread(), Sector::Sector(), worldmap::WorldMap::setup(), Sector::try_expose(), worldmap::WorldMap::try_expose(), Sector::try_expose_me(), Sector::try_unexpose(), worldmap::WorldMap::try_unexpose(), Sector::try_unexpose_me(), scripting::TimeScheduler::update(), scripting::ThreadQueue::wakeup(), worldmap::WorldMap::WorldMap(), Console::~Console(), Sector::~Sector(), World::~World(), and worldmap::WorldMap::~WorldMap().
HSQUIRRELVM scripting::global_vm = NULL |
Definition at line 39 of file squirrel_util.cpp.
Referenced by Sector::activate(), scripting::ThreadQueue::add(), Sector::deactivate(), exit_squirrel(), init_squirrel(), worldmap::WorldMap::leave(), World::load_state(), worldmap::WorldMap::load_state(), Console::ready_vm(), World::run(), GameSession::run_script(), Sector::run_script(), worldmap::WorldMap::run_script(), World::save_state(), worldmap::WorldMap::save_state(), scripting::TimeScheduler::schedule_thread(), Sector::Sector(), worldmap::WorldMap::setup(), worldmap::WorldMap::try_expose(), Sector::try_expose(), Sector::try_expose_me(), worldmap::WorldMap::try_unexpose(), Sector::try_unexpose(), Sector::try_unexpose_me(), scripting::TimeScheduler::update(), scripting::ThreadQueue::wakeup(), worldmap::WorldMap::WorldMap(), Console::~Console(), Sector::~Sector(), World::~World(), and worldmap::WorldMap::~WorldMap().