diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 9a443be4b0..88d5aa1177 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -56,23 +56,6 @@ private: bool frame_is_new; // true if frame hasn't let been requested public: - void Update( float fDeltaTime ) - { - secsIntoPlay += fDeltaTime; - while( secsIntoPlay > streamSecs ) - { - secsIntoPlay -= streamSecs; - } - - int this_frame = secsIntoPlay/streamSecs*numFrames; - - if( last_frame != this_frame ) - { - frame_is_new = true; - GetFrame( this_frame ); - last_frame = this_frame; - } - } int GetVideoWidth() { return videoWidth; } int GetVideoHeight() { return videoHeight; } int GetFrameWidth() { return frameWidth; } @@ -91,11 +74,8 @@ public: AVIFileInit(); // Opens The AVIFile Library // Opens The AVI Stream - if (AVIStreamOpenFromFile(&pavi, sFile, streamtypeVIDEO, 0, OF_READ, NULL) !=0) - { - // An Error Occurred Opening The Stream - MessageBox (HWND_DESKTOP, "Failed To Open The AVI Stream", "Error", MB_OK | MB_ICONEXCLAMATION); - } + if (AVIStreamOpenFromFile(&pavi, sFile, streamtypeVIDEO, 0, OF_READ, NULL) !=0 ) + throw RageException( "Failed To Open The AVI Stream" ); AVIStreamInfo(pavi, &psi, sizeof(psi)); // Reads Information About The Stream Into psi videoWidth=psi.rcFrame.right-psi.rcFrame.left; // Width Is Right Side Of Frame Minus Left @@ -121,10 +101,7 @@ public: pgf=AVIStreamGetFrameOpen(pavi, NULL); // Create The PGETFRAME Using Our Request Mode if (pgf==NULL) - { - // An Error Occurred Opening The Frame - MessageBox (HWND_DESKTOP, "Failed To Open The AVI Frame", "Error", MB_OK | MB_ICONEXCLAMATION); - } + throw RageException( "Failed To Open The AVI Frame" ); } ~AviRenderer(void) // Properly Closes The Avi File @@ -136,6 +113,24 @@ public: AVIFileExit(); // Release The File } + void Update( float fDeltaTime ) + { + secsIntoPlay += fDeltaTime; + while( secsIntoPlay > streamSecs ) + { + secsIntoPlay -= streamSecs; + } + + int this_frame = secsIntoPlay/streamSecs*numFrames; + + if( last_frame != this_frame ) + { + frame_is_new = true; + GetFrame( this_frame ); + last_frame = this_frame; + } + } + void flipIt(void* buffer) // Flips The Red And Blue Bytes (256x256) { void* b = buffer; // Pointer To The Buffer @@ -181,7 +176,7 @@ public: // 1:1 copy into the new surface DrawDibDraw (hdd, hdc, 0, 0, videoWidth, videoHeight, lpbi, pdata, 0, 0, videoWidth, videoHeight, 0); -// flipIt(data); // Swap The Red And Blue Bytes (GL Compatability) + flipIt(data); // Swap The Red And Blue Bytes (GL Compatability) } }; @@ -310,16 +305,23 @@ void RageMovieTexture::Create() unsigned int RageMovieTexture::GetGLTextureID() { - unsigned char* data = pAviRenderer->GetData(); + if( pAviRenderer->IsNewFrameReady() ) + { + unsigned char* data = pAviRenderer->GetData(); - // Update The Texture - glBindTexture( GL_TEXTURE_2D, m_uGLTextureID ); - glPixelStorei(GL_UNPACK_ROW_LENGTH, m_iTextureWidth); - glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, m_iTextureWidth, m_iTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, data); + // Update The Texture + glBindTexture( GL_TEXTURE_2D, m_uGLTextureID ); + glPixelStorei(GL_UNPACK_ROW_LENGTH, m_iTextureWidth); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, m_iTextureWidth, m_iTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, data); + } return m_uGLTextureID; } +void RageMovieTexture::Update( float fDeltaTime ) +{ + pAviRenderer->Update( fDeltaTime ); +} void RageMovieTexture::Play() { diff --git a/stepmania/src/RageMovieTexture.h b/stepmania/src/RageMovieTexture.h index 8266c76ebd..663a00e0a7 100644 --- a/stepmania/src/RageMovieTexture.h +++ b/stepmania/src/RageMovieTexture.h @@ -22,6 +22,7 @@ class RageMovieTexture : public RageTexture public: RageMovieTexture( CString sFilePath, RageTexturePrefs prefs ); virtual ~RageMovieTexture(); + virtual void Update( float fDeltaTime ); virtual void Invalidate() { m_uGLTextureID = 0; } virtual void Reload( RageTexturePrefs prefs ); diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index 562993dfa0..5d0c7d36db 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -46,6 +46,7 @@ class RageTexture public: RageTexture( CString sFilePath, RageTexturePrefs prefs ); virtual ~RageTexture() = 0; + virtual void Update( float fDeltaTime ) {} virtual void Reload( RageTexturePrefs prefs ) = 0; virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */ virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index ae6dd122f9..63a09d8ae3 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -43,6 +43,15 @@ RageTextureManager::~RageTextureManager() } } +void RageTextureManager::Update( float fDeltaTime ) +{ + for( std::map::iterator i = m_mapPathToTexture.begin(); + i != m_mapPathToTexture.end(); ++i) + { + RageTexture* pTexture = i->second; + pTexture->Update( fDeltaTime ); + } +} //----------------------------------------------------------------------------- // Load/Unload textures from disk diff --git a/stepmania/src/RageTextureManager.h b/stepmania/src/RageTextureManager.h index a930211d5e..4ed55f9f97 100644 --- a/stepmania/src/RageTextureManager.h +++ b/stepmania/src/RageTextureManager.h @@ -22,6 +22,7 @@ class RageTextureManager { public: RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload ); + virtual void Update( float fDeltaTime ); ~RageTextureManager(); RageTexture* LoadTexture( CString sTexturePath, RageTexturePrefs prefs ); diff --git a/stepmania/src/ScreenSandbox.cpp b/stepmania/src/ScreenSandbox.cpp index 7cb97448eb..af2e83439c 100644 --- a/stepmania/src/ScreenSandbox.cpp +++ b/stepmania/src/ScreenSandbox.cpp @@ -37,7 +37,7 @@ ScreenSandbox::ScreenSandbox() m_quad.SetDiffuse( RageColor(1,1,1,1) ); this->AddChild( &m_quad ); - m_sprite.Load( "C:\\stepmania\\stepmania\\RandomMovies\\face2.avi" ); + m_sprite.Load( "C:\\stepmania\\stepmania\\RandomMovies\\cm301[1].avi" ); m_sprite.SetXY( CENTER_X, CENTER_Y ); this->AddChild( &m_sprite ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 519b44327a..6e769633ea 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -491,6 +491,7 @@ void GameLoop() if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_GRAVE) ) ) fDeltaTime /= 4; + TEXTUREMAN->Update( fDeltaTime ); MUSIC->Update( fDeltaTime ); SCREENMAN->Update( fDeltaTime ); NETWORK->Update( fDeltaTime ); diff --git a/stepmania/src/plib-1.6.0/sg.lib b/stepmania/src/plib-1.6.0/sg.lib index bc13c7b297..57380e87a1 100644 Binary files a/stepmania/src/plib-1.6.0/sg.lib and b/stepmania/src/plib-1.6.0/sg.lib differ diff --git a/stepmania/src/plib-1.6.0/src/sg/sg.dsp b/stepmania/src/plib-1.6.0/src/sg/sg.dsp index dd18c674f9..6fdbc7aabd 100644 --- a/stepmania/src/plib-1.6.0/src/sg/sg.dsp +++ b/stepmania/src/plib-1.6.0/src/sg/sg.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\util" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\util" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" diff --git a/stepmania/src/plib-1.6.0/src/util/ul.dsp b/stepmania/src/plib-1.6.0/src/util/ul.dsp index bbf22b9cb2..62df1359d6 100644 --- a/stepmania/src/plib-1.6.0/src/util/ul.dsp +++ b/stepmania/src/plib-1.6.0/src/util/ul.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" diff --git a/stepmania/src/plib-1.6.0/ul.lib b/stepmania/src/plib-1.6.0/ul.lib index 13b8ff65e9..22e3737ee8 100644 Binary files a/stepmania/src/plib-1.6.0/ul.lib and b/stepmania/src/plib-1.6.0/ul.lib differ diff --git a/stepmania/src/plib-1.6.0/ul_d.lib b/stepmania/src/plib-1.6.0/ul_d.lib index 8b4c9959e2..c09117d413 100644 Binary files a/stepmania/src/plib-1.6.0/ul_d.lib and b/stepmania/src/plib-1.6.0/ul_d.lib differ