Added stop() to script-bound sounds

This commit is contained in:
Sachith Hasaranga Seneviratne
2014-07-12 07:34:35 +05:30
parent f61fd2b13a
commit 44d502d1fe
4 changed files with 9 additions and 2 deletions

View File

@@ -15,6 +15,9 @@ void haybail()
Animator @haybailAnimator = t_obj.getAnimator();
haybailAnimator.setPaused(true);
//if (haybail.isFlattener())squashKart(0,35.0);
TrackObject @moo_sound = getTrackObject("cow");
SoundEmitter @cowmoo = moo_sound.getSoundEmitter();
cowmoo.stop();
}
void haybail_deactivate()

View File

@@ -2,4 +2,5 @@ void onUpdate()
{
Vec3 tele = Vec3(0,0,0);
//teleportKart(0,tele);
}

View File

@@ -113,8 +113,6 @@ namespace Scripting
r = engine->RegisterGlobalFunction("void setVelocity(int id, Vec3 &in)", asFUNCTION(setVelocity), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("void jumpKartTo(int id, float x, float y)", asFUNCTION(jumpKartTo), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("Vec3 getKartLocation(int id)", asFUNCTION(getKartLocation), asCALL_GENERIC); assert(r >= 0);
}
}
}

View File

@@ -79,6 +79,10 @@ namespace Scripting
core::vector3df scale = core::vector3df(1, 1, 1);
((TrackObjectPresentation*)(memory))->move(xyz, hpr, scale);
}
void stop(void *memory)
{
((TrackObjectPresentationSound*)memory)->stopSound();
}
void setLoop(int start, int end, void *memory)
{
((TrackObjectPresentationMesh*)(memory))->setLoop(start,end);
@@ -177,6 +181,7 @@ namespace Scripting
r = engine->RegisterObjectType("SoundEmitter", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
r = engine->RegisterObjectMethod("TrackObject", "SoundEmitter @getSoundEmitter()", asMETHOD(TrackObject, getSound), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("SoundEmitter", "void move(Vec3 &in)", asFUNCTION(movePresentation), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SoundEmitter", "void stop()", asFUNCTION(stop), asCALL_CDECL_OBJLAST); assert(r >= 0);