#include "object/brick.hpp"
#include "object/bullet.hpp"
#include "object/camera.hpp"
+#include "object/cloud_particle_system.hpp"
#include "object/coin.hpp"
+#include "object/comet_particle_system.hpp"
#include "object/display_effect.hpp"
+#include "object/ghost_particle_system.hpp"
#include "object/gradient.hpp"
#include "object/invisible_block.hpp"
#include "object/particlesystem.hpp"
-#include "object/cloud_particle_system.hpp"
-#include "object/ghost_particle_system.hpp"
-#include "object/snow_particle_system.hpp"
#include "object/particlesystem_interactive.hpp"
#include "object/player.hpp"
#include "object/portable.hpp"
#include "object/pulsing_light.hpp"
+#include "object/rain_particle_system.hpp"
#include "object/smoke_cloud.hpp"
+#include "object/snow_particle_system.hpp"
#include "object/text_object.hpp"
#include "object/tilemap.hpp"
#include "physfs/ifile_stream.hpp"
#include "scripting/squirrel_util.hpp"
#include "supertux/collision.hpp"
#include "supertux/constants.hpp"
-#include "supertux/level.hpp"
#include "supertux/globals.hpp"
+#include "supertux/level.hpp"
#include "supertux/object_factory.hpp"
#include "supertux/spawn_point.hpp"
#include "supertux/tile.hpp"
sound_manager->preload("sounds/shoot.wav");
// create a new squirrel table for the sector
- using namespace Scripting;
+ using namespace scripting;
sq_collectgarbage(global_vm);
sq_newtable(global_vm);
sq_pushroottable(global_vm);
if(SQ_FAILED(sq_setdelegate(global_vm, -2)))
- throw Scripting::SquirrelError(global_vm, "Couldn't set sector_table delegate");
+ throw scripting::SquirrelError(global_vm, "Couldn't set sector_table delegate");
sq_resetobject(§or_table);
if(SQ_FAILED(sq_getstackobj(global_vm, -1, §or_table)))
- throw Scripting::SquirrelError(global_vm, "Couldn't get sector table");
+ throw scripting::SquirrelError(global_vm, "Couldn't get sector table");
sq_addref(global_vm, §or_table);
sq_pop(global_vm, 1);
}
Sector::~Sector()
{
- using namespace Scripting;
+ using namespace scripting;
deactivate();
return partsys;
} else if(name == "money") { // for compatibility with old maps
return new Jumpy(reader);
+ } else {
+ try {
+ return create_object(name, reader);
+ } catch(std::exception& e) {
+ log_warning << e.what() << "" << std::endl;
+ return 0;
+ }
}
-
- try {
- return create_object(name, reader);
- } catch(std::exception& e) {
- log_warning << e.what() << "" << std::endl;
- }
-
- return 0;
}
void
} else if(token == "music") {
iter.value()->get(music);
} else if(token == "spawnpoint") {
- SpawnPoint* sp = new SpawnPoint(iter.lisp());
+ SpawnPoint* sp = new SpawnPoint(*iter.lisp());
spawnpoints.push_back(sp);
} else if(token == "init-script") {
iter.value()->get(init_script);
HSQUIRRELVM
Sector::run_script(std::istream& in, const std::string& sourcename)
{
- using namespace Scripting;
+ using namespace scripting;
// garbage collect thread list
for(ScriptList::iterator i = scripts.begin();
_current = this;
// register sectortable as sector in scripting
- HSQUIRRELVM vm = Scripting::global_vm;
+ HSQUIRRELVM vm = scripting::global_vm;
sq_pushroottable(vm);
sq_pushstring(vm, "sector", -1);
sq_pushobject(vm, sector_table);
if(SQ_FAILED(sq_createslot(vm, -3)))
- throw Scripting::SquirrelError(vm, "Couldn't set sector in roottable");
+ throw scripting::SquirrelError(vm, "Couldn't set sector in roottable");
sq_pop(vm, 1);
for(GameObjects::iterator i = gameobjects.begin();
return;
// remove sector entry from global vm
- HSQUIRRELVM vm = Scripting::global_vm;
+ HSQUIRRELVM vm = scripting::global_vm;
sq_pushroottable(vm);
sq_pushstring(vm, "sector", -1);
if(SQ_FAILED(sq_deleteslot(vm, -2, SQFalse)))
- throw Scripting::SquirrelError(vm, "Couldn't unset sector in roottable");
+ throw scripting::SquirrelError(vm, "Couldn't unset sector in roottable");
sq_pop(vm, 1);
for(GameObjects::iterator i = gameobjects.begin();
{
ScriptInterface* interface = dynamic_cast<ScriptInterface*> (object);
if(interface != NULL) {
- HSQUIRRELVM vm = Scripting::global_vm;
+ HSQUIRRELVM vm = scripting::global_vm;
sq_pushobject(vm, sector_table);
interface->expose(vm, -1);
sq_pop(vm, 1);
void
Sector::try_expose_me()
{
- HSQUIRRELVM vm = Scripting::global_vm;
+ HSQUIRRELVM vm = scripting::global_vm;
sq_pushobject(vm, sector_table);
- Scripting::SSector* interface = static_cast<Scripting::SSector*> (this);
+ scripting::SSector* interface = static_cast<scripting::SSector*> (this);
expose_object(vm, -1, interface, "settings", false);
sq_pop(vm, 1);
}
{
ScriptInterface* interface = dynamic_cast<ScriptInterface*> (object);
if(interface != NULL) {
- HSQUIRRELVM vm = Scripting::global_vm;
+ HSQUIRRELVM vm = scripting::global_vm;
SQInteger oldtop = sq_gettop(vm);
sq_pushobject(vm, sector_table);
try {
void
Sector::try_unexpose_me()
{
- HSQUIRRELVM vm = Scripting::global_vm;
+ HSQUIRRELVM vm = scripting::global_vm;
SQInteger oldtop = sq_gettop(vm);
sq_pushobject(vm, sector_table);
try {
- Scripting::unexpose_object(vm, -1, "settings");
+ scripting::unexpose_object(vm, -1, "settings");
} catch(std::exception& e) {
log_warning << "Couldn't unregister object: " << e.what() << std::endl;
}