diff options
author | Eugene Sandulenko | 2010-08-04 14:53:07 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 22:22:33 +0000 |
commit | 9b3e26e7a29756848395d7a12928efdb60b8ff21 (patch) | |
tree | 1d4b745342b1f259f5c74ef994ad470e05783216 /engines/sword25/fmv/movieplayer_script.cpp | |
parent | 8533538c8343bedbb22b19b5fef738ac54bd84c3 (diff) | |
download | scummvm-rg350-9b3e26e7a29756848395d7a12928efdb60b8ff21.tar.gz scummvm-rg350-9b3e26e7a29756848395d7a12928efdb60b8ff21.tar.bz2 scummvm-rg350-9b3e26e7a29756848395d7a12928efdb60b8ff21.zip |
SWORD25: Start for VideoDecoder-compatible Theora player.
svn-id: r53206
Diffstat (limited to 'engines/sword25/fmv/movieplayer_script.cpp')
-rw-r--r-- | engines/sword25/fmv/movieplayer_script.cpp | 196 |
1 files changed, 92 insertions, 104 deletions
diff --git a/engines/sword25/fmv/movieplayer_script.cpp b/engines/sword25/fmv/movieplayer_script.cpp index f95dc90b1d..523cc2d4f3 100644 --- a/engines/sword25/fmv/movieplayer_script.cpp +++ b/engines/sword25/fmv/movieplayer_script.cpp @@ -23,7 +23,7 @@ * */ -/* +/* * This code is based on Broken Sword 2.5 engine * * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer @@ -45,150 +45,138 @@ namespace Sword25 { - int LoadMovie(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); +int LoadMovie(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->LoadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<unsigned int>(luaL_checknumber(L, 2)) : 10)); + lua_pushbooleancpp(L, FMVPtr->LoadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<unsigned int>(luaL_checknumber(L, 2)) : 10)); - return 1; - } - - // ------------------------------------------------------------------------- - - int UnloadMovie(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); - - lua_pushbooleancpp(L, FMVPtr->UnloadMovie()); + return 1; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int UnloadMovie(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int Play(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + lua_pushbooleancpp(L, FMVPtr->UnloadMovie()); - lua_pushbooleancpp(L, FMVPtr->Play()); + return 1; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int Play(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int Pause(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + lua_pushbooleancpp(L, FMVPtr->Play()); - lua_pushbooleancpp(L, FMVPtr->Pause()); + return 1; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int Pause(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int Update(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + lua_pushbooleancpp(L, FMVPtr->Pause()); - FMVPtr->Update(); + return 1; +} - return 0; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int Update(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int IsMovieLoaded(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + FMVPtr->Update(); - lua_pushbooleancpp(L, FMVPtr->IsMovieLoaded()); + return 0; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int IsMovieLoaded(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int IsPaused(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + lua_pushbooleancpp(L, FMVPtr->IsMovieLoaded()); - lua_pushbooleancpp(L, FMVPtr->IsPaused()); + return 1; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int IsPaused(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int GetScaleFactor(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + lua_pushbooleancpp(L, FMVPtr->IsPaused()); - lua_pushnumber(L, FMVPtr->GetScaleFactor()); + return 1; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int GetScaleFactor(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int SetScaleFactor(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + lua_pushnumber(L, FMVPtr->GetScaleFactor()); - FMVPtr->SetScaleFactor(static_cast<float>(luaL_checknumber(L, 1))); + return 1; +} - return 0; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int SetScaleFactor(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - int GetTime(lua_State * L) - { - BS_MoviePlayer * FMVPtr = BS_Kernel::GetInstance()->GetFMV(); - BS_ASSERT(FMVPtr); + FMVPtr->SetScaleFactor(static_cast<float>(luaL_checknumber(L, 1))); - lua_pushnumber(L, FMVPtr->GetTime()); + return 0; +} - return 1; - } +// ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- +int GetTime(lua_State *L) { + BS_MoviePlayer *FMVPtr = BS_Kernel::GetInstance()->GetFMV(); + BS_ASSERT(FMVPtr); - const char * LIBRARY_NAME = "Movieplayer"; + lua_pushnumber(L, FMVPtr->GetTime()); - const luaL_reg LIBRARY_FUNCTIONS[] = - { - { "LoadMovie", LoadMovie }, - { "UnloadMovie", UnloadMovie }, - { "Play", Play }, - { "Pause", Pause }, - { "Update", Update }, - { "IsMovieLoaded", IsMovieLoaded }, - { "IsPaused", IsPaused }, - { "GetScaleFactor", GetScaleFactor }, - { "SetScaleFactor", SetScaleFactor }, - { "GetTime", GetTime }, - { 0, 0 } - }; + return 1; +} -bool BS_MoviePlayer::_RegisterScriptBindings() -{ - BS_Kernel * pKernel = BS_Kernel::GetInstance(); +// ------------------------------------------------------------------------- + +const char *LIBRARY_NAME = "Movieplayer"; + +const luaL_reg LIBRARY_FUNCTIONS[] = { + { "LoadMovie", LoadMovie }, + { "UnloadMovie", UnloadMovie }, + { "Play", Play }, + { "Pause", Pause }, + { "Update", Update }, + { "IsMovieLoaded", IsMovieLoaded }, + { "IsPaused", IsPaused }, + { "GetScaleFactor", GetScaleFactor }, + { "SetScaleFactor", SetScaleFactor }, + { "GetTime", GetTime }, + { 0, 0 } +}; + +bool BS_MoviePlayer::_RegisterScriptBindings() { + BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine * pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); + BS_ScriptEngine *pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script")); BS_ASSERT(pScript); - lua_State * L = static_cast<lua_State *>(pScript->GetScriptObject()); + lua_State *L = static_cast<lua_State *>(pScript->GetScriptObject()); BS_ASSERT(L); if (!BS_LuaBindhelper::AddFunctionsToLib(L, LIBRARY_NAME, LIBRARY_FUNCTIONS)) return false; |