Set up polymorhic overriding for script-bound TrackObjectPresentation methods

This commit is contained in:
Sachith Hasaranga Seneviratne
2014-07-11 07:35:24 +05:30
parent f4b357d03c
commit f9e1f16c47

View File

@@ -69,7 +69,7 @@ namespace Scripting
{
((ThreeDAnimation*)(memory))->setPaused(mode);
}
void moveMesh(Vec3 *new_pos,void *memory)
void movePresentation(Vec3 *new_pos, void *memory)
{
core::vector3df xyz = core::vector3df(0, 0, 0);
xyz.X = new_pos->getX();
@@ -77,27 +77,7 @@ namespace Scripting
xyz.Z = new_pos->getZ();
core::vector3df hpr = core::vector3df(0, 0, 0);
core::vector3df scale = core::vector3df(1, 1, 1);
((TrackObjectPresentationMesh*)(memory))->move(xyz, hpr, scale);
}
void moveSound(Vec3 *new_pos, void *memory)
{
core::vector3df xyz = core::vector3df(0, 0, 0);
xyz.X = new_pos->getX();
xyz.Y = new_pos->getY();
xyz.Z = new_pos->getZ();
core::vector3df hpr = core::vector3df(0, 0, 0);
core::vector3df scale = core::vector3df(1, 1, 1);
((TrackObjectPresentationSound*)(memory))->move(xyz, hpr, scale);
}
void moveParticles(Vec3 *new_pos, void *memory)
{
core::vector3df xyz = core::vector3df(0, 0, 0);
xyz.X = new_pos->getX();
xyz.Y = new_pos->getY();
xyz.Z = new_pos->getZ();
core::vector3df hpr = core::vector3df(0, 0, 0);
core::vector3df scale = core::vector3df(1, 1, 1);
((TrackObjectPresentationParticles*)(memory))->move(xyz, hpr, scale);
((TrackObjectPresentation*)(memory))->move(xyz, hpr, scale);
}
void setLoop(int start, int end, void *memory)
{
@@ -186,17 +166,17 @@ namespace Scripting
r = engine->RegisterObjectMethod("Mesh", "void setLoop(int start, int end)", asFUNCTION(setLoop), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("Mesh", "int getCurrentFrame()", asFUNCTION(getCurrentFrame), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("Mesh", "void setCurrentFrame(int frame)", asFUNCTION(setCurrentFrame), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("Mesh", "void move(Vec3 &in)", asFUNCTION(moveMesh), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("Mesh", "void move(Vec3 &in)", asFUNCTION(movePresentation), asCALL_CDECL_OBJLAST); assert(r >= 0);
//Particle Emitter
r = engine->RegisterObjectType("ParticleEmitter", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
r = engine->RegisterObjectMethod("TrackObject", "ParticleEmitter @getParticleEmitter()", asMETHOD(TrackObject, getParticles), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("ParticleEmitter", "void move(Vec3 &in)", asFUNCTION(moveParticles), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("ParticleEmitter", "void move(Vec3 &in)", asFUNCTION(movePresentation), asCALL_CDECL_OBJLAST); assert(r >= 0);
//Sound Effect
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(moveSound), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SoundEmitter", "void move(Vec3 &in)", asFUNCTION(movePresentation), asCALL_CDECL_OBJLAST); assert(r >= 0);