#include <squirrel.h>
#include <iostream>
+#include "timer.h"
+#include "game_object.h"
+#include "scripting/sound.h"
+#include "scripting/level.h"
-class ScriptInterpreter
+class Sector;
+
+class ScriptInterpreter : public GameObject
{
public:
- ScriptInterpreter();
- ~ScriptInterpreter();
+ ScriptInterpreter(Sector* sector);
+ ~ScriptInterpreter();
+
+ void draw(DrawingContext& );
+ void action(float );
+
+ void load_script(std::istream& in, const std::string& sourcename = "");
+ void start_script();
+
+ void expose_object(void* object, const std::string& name,
+ const std::string& type);
- void load_script(std::istream& in, const std::string& sourcename = "");
- void run_script();
- void resume_script();
- bool script_suspended();
+ void set_wakeup_time(float seconds);
+
+ static ScriptInterpreter* current()
+ {
+ return _current;
+ }
private:
- HSQUIRRELVM v;
+ HSQUIRRELVM v;
+ static ScriptInterpreter* _current;
+ Timer wakeup_timer;
+
+ Scripting::Sound* sound;
+ Scripting::Level* level;
};
#endif