/* Default functions for the whole levelset */
-function wait(time) {
- set_wakeup_time(time);
- suspend();
-}
-
void
SoundManager::set_listener_position(const Vector& pos)
{
+ static Uint32 lastticks = SDL_GetTicks();
+
+ Uint32 current_ticks = SDL_GetTicks();
+ if(current_ticks - lastticks < 300)
+ return;
+ lastticks = current_ticks;
+
alListener3f(AL_POSITION, pos.x, pos.y, 0);
}
void
SoundManager::update()
{
+ static Uint32 lastticks = SDL_GetTicks();
+
+ Uint32 current_ticks = SDL_GetTicks();
+ if(current_ticks - lastticks < 300)
+ return;
+ lastticks = current_ticks;
+
// check for finished sound sources
for(SoundSources::iterator i = sources.begin(); i != sources.end(); ) {
SoundSource* source = *i;
running = false;
box->draw(*context);
draw();
+ sound_manager->update();
}
delete box;
namespace Scripting
{
-void set_wakeup_time(float seconds)
+void wait(float seconds)
{
ScriptInterpreter::current()->set_wakeup_time(seconds);
}
/** displays a text file and scrolls it over the screen */
void display_text_file(const std::string& filename);
-/** Suspends the script execution for the specified number of seconds */
-void set_wakeup_time(float seconds);
+/** @SUSPEND@
+ * Suspends the script execution for the specified number of seconds
+ * */
+void wait(float seconds);
/** translates a give text into the users language (by looking it up in the .po
* files)
*/
return 0;
}
-static int set_wakeup_time_wrapper(HSQUIRRELVM v)
+static int wait_wrapper(HSQUIRRELVM v)
{
float arg0;
sq_getfloat(v, 2, &arg0);
- Scripting::set_wakeup_time(arg0);
+ Scripting::wait(arg0);
- return 0;
+ return sq_suspendvm(v);
}
static int translate_wrapper(HSQUIRRELVM v)
WrappedFunction supertux_global_functions[] = {
{ "display_text_file", &display_text_file_wrapper },
- { "set_wakeup_time", &set_wakeup_time_wrapper },
+ { "wait", &wait_wrapper },
{ "translate", &translate_wrapper },
{ "import", &import_wrapper },
{ 0, 0 }