From bf22def884986e4bd5bec2b42dea7f91b5417ccc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 29 Sep 2010 10:40:06 +0000 Subject: SWORD25: Enforce code naming conventions in fmv/* svn-id: r53388 --- engines/sword25/fmv/movieplayer.cpp | 22 ++++---- engines/sword25/fmv/movieplayer.h | 31 +++++------ engines/sword25/fmv/movieplayer_script.cpp | 86 +++++++++++------------------- engines/sword25/fmv/yuvtorgba.cpp | 11 ++-- engines/sword25/fmv/yuvtorgba.h | 10 +--- 5 files changed, 58 insertions(+), 102 deletions(-) (limited to 'engines') diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 8b1d6d2e08..f6757b9a8e 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -50,7 +50,7 @@ Service *OggTheora_CreateObject(Kernel *pKernel) { } MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel), _decoder(g_system->getMixer()) { - if (!_RegisterScriptBindings()) + if (!registerScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); else BS_LOGLN("Script bindings registered."); @@ -60,7 +60,7 @@ MoviePlayer::~MoviePlayer() { _decoder.close(); } -bool MoviePlayer::LoadMovie(const Common::String &filename, uint z) { +bool MoviePlayer::loadMovie(const Common::String &filename, uint z) { // Get the file and load it into the decoder Common::SeekableReadStream *in = Kernel::GetInstance()->GetPackage()->getStream(filename); _decoder.load(in); @@ -93,24 +93,24 @@ bool MoviePlayer::LoadMovie(const Common::String &filename, uint z) { return true; } -bool MoviePlayer::UnloadMovie() { +bool MoviePlayer::unloadMovie() { _decoder.close(); _outputBitmap.erase(); return true; } -bool MoviePlayer::Play() { +bool MoviePlayer::play() { _decoder.pauseVideo(false); return true; } -bool MoviePlayer::Pause() { +bool MoviePlayer::pause() { _decoder.pauseVideo(true); return true; } -void MoviePlayer::Update() { +void MoviePlayer::update() { if (_decoder.isVideoLoaded()) { Graphics::Surface *s = _decoder.decodeNextFrame(); @@ -121,22 +121,22 @@ void MoviePlayer::Update() { } } -bool MoviePlayer::IsMovieLoaded() { +bool MoviePlayer::isMovieLoaded() { return _decoder.isVideoLoaded(); } -bool MoviePlayer::IsPaused() { +bool MoviePlayer::isPaused() { return _decoder.isPaused(); } -float MoviePlayer::GetScaleFactor() { +float MoviePlayer::getScaleFactor() { if (_decoder.isVideoLoaded()) return _outputBitmap->getScaleFactorX(); else return 0; } -void MoviePlayer::SetScaleFactor(float scaleFactor) { +void MoviePlayer::setScaleFactor(float scaleFactor) { if (_decoder.isVideoLoaded()) { _outputBitmap->setScaleFactor(scaleFactor); @@ -147,7 +147,7 @@ void MoviePlayer::SetScaleFactor(float scaleFactor) { } } -double MoviePlayer::GetTime() { +double MoviePlayer::getTime() { return _decoder.getElapsedTime() / 1000.0; } diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h index f72178a707..96beb648c0 100644 --- a/engines/sword25/fmv/movieplayer.h +++ b/engines/sword25/fmv/movieplayer.h @@ -35,10 +35,6 @@ #ifndef SWORD25_MOVIEPLAYER_H #define SWORD25_MOVIEPLAYER_H -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - #include "sword25/kernel/common.h" #include "sword25/kernel/service.h" #include "sword25/fmv/theora_decoder.h" @@ -46,10 +42,6 @@ namespace Sword25 { -// ----------------------------------------------------------------------------- -// Class definitions -// ----------------------------------------------------------------------------- - class MoviePlayer : public Service { public: // ----------------------------------------------------------------------------- @@ -73,14 +65,14 @@ public: * @param Z Z indicates the position of the film on the main graphics layer * @return Returns false if an error occured while loading, otherwise true. */ - bool LoadMovie(const Common::String &Filename, uint Z); + bool loadMovie(const Common::String &filename, uint z); /** * Unloads the currently loaded movie file. * @return Returns false if an error occurred while unloading, otherwise true. * @remark This method can only be called when IsMovieLoaded() returns true. */ - bool UnloadMovie(); + bool unloadMovie(); /** * Plays the loaded movie. @@ -90,7 +82,7 @@ public: * @return Returns false if an error occurred while starting, otherwise true. * @remark This method can only be called when IsMovieLoaded() returns true. */ - bool Play(); + bool play(); /** * Pauses movie playback. @@ -99,23 +91,23 @@ public: * @return Returns false if an error occurred while pausing, otherwise true. * @remark This method can only be called when IsMovieLoaded() returns true. */ - bool Pause(); + bool pause(); /** * This function must be called once per frame. */ - void Update(); + void update(); /** * Returns whether a film is loaded for playback. */ - bool IsMovieLoaded(); + bool isMovieLoaded(); /** * Returns whether the movie playback is paused. * @remark This method can only be called when IsMovieLoaded() returns true. */ - bool IsPaused(); + bool isPaused(); /** * Returns the scaling factor for the loaded film. @@ -125,22 +117,23 @@ public: * @return Returns the scaling factor of the film. * @remark This method can only be called when IsMovieLoaded() returns true. */ - float GetScaleFactor(); + float getScaleFactor(); /** * Sets the factor by which the loaded film is to be scaled. * @param ScaleFactor The desired scale factor. * @remark This method can only be called when IsMovieLoaded() returns true. */ - void SetScaleFactor(float ScaleFactor); + void setScaleFactor(float scaleFactor); /** * Returns the current playing position in seconds. * @remark This method can only be called when IsMovieLoaded() returns true. */ - double GetTime(); + double getTime(); + private: - bool _RegisterScriptBindings(); + bool registerScriptBindings(); TheoraDecoder _decoder; diff --git a/engines/sword25/fmv/movieplayer_script.cpp b/engines/sword25/fmv/movieplayer_script.cpp index 60d42ac2b5..8a47721c95 100644 --- a/engines/sword25/fmv/movieplayer_script.cpp +++ b/engines/sword25/fmv/movieplayer_script.cpp @@ -32,10 +32,6 @@ * */ -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - #include "sword25/kernel/common.h" #include "sword25/kernel/kernel.h" #include "sword25/script/script.h" @@ -45,133 +41,113 @@ namespace Sword25 { -int LoadMovie(lua_State *L) { +int loadMovie(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->LoadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast(luaL_checknumber(L, 2)) : 10)); + lua_pushbooleancpp(L, FMVPtr->loadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast(luaL_checknumber(L, 2)) : 10)); return 1; } -// ------------------------------------------------------------------------- - -int UnloadMovie(lua_State *L) { +int unloadMovie(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->UnloadMovie()); + lua_pushbooleancpp(L, FMVPtr->unloadMovie()); return 1; } -// ------------------------------------------------------------------------- - -int Play(lua_State *L) { +int play(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->Play()); + lua_pushbooleancpp(L, FMVPtr->play()); return 1; } -// ------------------------------------------------------------------------- - -int Pause(lua_State *L) { +int pause(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->Pause()); + lua_pushbooleancpp(L, FMVPtr->pause()); return 1; } -// ------------------------------------------------------------------------- - -int Update(lua_State *L) { +int update(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - FMVPtr->Update(); + FMVPtr->update(); return 0; } -// ------------------------------------------------------------------------- - -int IsMovieLoaded(lua_State *L) { +int isMovieLoaded(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->IsMovieLoaded()); + lua_pushbooleancpp(L, FMVPtr->isMovieLoaded()); return 1; } -// ------------------------------------------------------------------------- - -int IsPaused(lua_State *L) { +int isPaused(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushbooleancpp(L, FMVPtr->IsPaused()); + lua_pushbooleancpp(L, FMVPtr->isPaused()); return 1; } -// ------------------------------------------------------------------------- - -int GetScaleFactor(lua_State *L) { +int getScaleFactor(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushnumber(L, FMVPtr->GetScaleFactor()); + lua_pushnumber(L, FMVPtr->getScaleFactor()); return 1; } -// ------------------------------------------------------------------------- - -int SetScaleFactor(lua_State *L) { +int setScaleFactor(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - FMVPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 1))); + FMVPtr->setScaleFactor(static_cast(luaL_checknumber(L, 1))); return 0; } -// ------------------------------------------------------------------------- - -int GetTime(lua_State *L) { +int getTime(lua_State *L) { MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV(); BS_ASSERT(FMVPtr); - lua_pushnumber(L, FMVPtr->GetTime()); + lua_pushnumber(L, FMVPtr->getTime()); return 1; } -// ------------------------------------------------------------------------- - 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 }, + { "LoadMovie", loadMovie }, + { "UnloadMovie", unloadMovie }, + { "Play", play }, + { "Pause", pause }, + { "Update", update }, + { "IsMovieLoaded", isMovieLoaded }, + { "IsPaused", isPaused }, + { "GetScaleFactor", getScaleFactor }, + { "SetScaleFactor", setScaleFactor }, + { "GetTime", getTime }, { 0, 0 } }; -bool MoviePlayer::_RegisterScriptBindings() { +bool MoviePlayer::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); ScriptEngine *pScript = static_cast(pKernel->GetService("script")); diff --git a/engines/sword25/fmv/yuvtorgba.cpp b/engines/sword25/fmv/yuvtorgba.cpp index 20ca610f98..12d11b6784 100644 --- a/engines/sword25/fmv/yuvtorgba.cpp +++ b/engines/sword25/fmv/yuvtorgba.cpp @@ -32,14 +32,9 @@ * */ -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - #include "sword25/fmv/yuvtorgba.h" namespace Sword25 { -// ----------------------------------------------------------------------------- static const int PRECISION = 32768; static const int COEFFS_Y[256] = { @@ -167,7 +162,7 @@ static const int CLAMP_TAB[1024] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, }; -void YUVtoBGRA::translate(th_ycbcr_buffer &YUVBuffer, const th_info &TheoraInfo, byte *PixelData, int PixelsSize) { +void YUVtoBGRA::translate(th_ycbcr_buffer &YUVBuffer, const th_info &theoraInfo, byte *pixelData, int pixelsSize) { // Width and height of all buffers have to be divisible by 2. BS_ASSERT((YUVBuffer[0].width & 1) == 0); @@ -187,8 +182,8 @@ void YUVtoBGRA::translate(th_ycbcr_buffer &YUVBuffer, const th_info &TheoraInfo, const byte *ySrc1 = YUVBuffer[0].data + YUVBuffer[0].stride; const byte *uSrc = YUVBuffer[1].data; const byte *vSrc = YUVBuffer[2].data; - byte *dst0 = &PixelData[0]; - byte *dst1 = &PixelData[0] + YUVBuffer[0].width * 4; + byte *dst0 = &pixelData[0]; + byte *dst1 = &pixelData[0] + YUVBuffer[0].width * 4; for (int h = 0; h < YUVBuffer[0].height / 2; ++h) { for (int w = 0; w < YUVBuffer[0].width / 2; ++w) { diff --git a/engines/sword25/fmv/yuvtorgba.h b/engines/sword25/fmv/yuvtorgba.h index 3df994abc8..15fa85b7e4 100644 --- a/engines/sword25/fmv/yuvtorgba.h +++ b/engines/sword25/fmv/yuvtorgba.h @@ -35,23 +35,15 @@ #ifndef SWORD25_YUVTORGBA_H #define SWORD25_YUVTORGBA_H -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - #include "sword25/kernel/common.h" #include #include namespace Sword25 { -// ----------------------------------------------------------------------------- -// Class definitions -// ----------------------------------------------------------------------------- - class YUVtoBGRA { public: - static void translate(th_ycbcr_buffer &YUVBuffer, const th_info &TheoraInfo, byte *PixelData, int PixelsSize); + static void translate(th_ycbcr_buffer &YUVBuffer, const th_info &theoraInfo, byte *pixelData, int pixelsSize); }; } // End of namespace Sword25 -- cgit v1.2.3