diff --git a/sp/src/game/client/c_sceneentity.cpp b/sp/src/game/client/c_sceneentity.cpp index b44b59fd4..0bc3139f0 100644 --- a/sp/src/game/client/c_sceneentity.cpp +++ b/sp/src/game/client/c_sceneentity.cpp @@ -804,6 +804,59 @@ CChoreoStringPool g_ChoreoStringPool; CChoreoScene *C_SceneEntity::LoadScene( const char *filename ) { +#if defined ( MOP_CLIENT_DLL ) + + char loadfile[MAX_PATH]; + Q_strncpy( loadfile, filename, sizeof( loadfile ) ); + Q_SetExtension( loadfile, ".vcd", sizeof( loadfile ) ); + Q_FixSlashes( loadfile ); + + void *pBuffer = 0; + CChoreoScene *pScene = NULL; + + int fileSize = filesystem->ReadFileEx( loadfile, "MOD", &pBuffer, true ); + if (fileSize) + { + g_TokenProcessor.SetBuffer((char*)pBuffer); + pScene = ChoreoLoadScene( loadfile, this, &g_TokenProcessor, Scene_Printf ); + } + else + { + fileSize = scenefilecache->GetSceneBufferSize( loadfile ); + if ( fileSize <= 0 ) + return NULL; + + pBuffer = new char[ fileSize ]; + if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, fileSize ) ) + { + delete[] pBuffer; + return NULL; + } + + + if ( IsBufferBinaryVCD( (char*)pBuffer, fileSize ) ) + { + pScene = new CChoreoScene( this ); + CUtlBuffer buf( pBuffer, fileSize, CUtlBuffer::READ_ONLY ); + if ( !pScene->RestoreFromBinaryBuffer( buf, loadfile, &g_ChoreoStringPool ) ) + { + Warning( "Unable to restore scene '%s'\n", loadfile ); + delete pScene; + pScene = NULL; + } + } + } + + if(pScene) + { + pScene->SetPrintFunc( Scene_Printf ); + pScene->SetEventCallbackInterface( this ); + } + + delete[] pBuffer; + return pScene; +#else + char loadfile[ 512 ]; Q_strncpy( loadfile, filename, sizeof( loadfile ) ); Q_SetExtension( loadfile, ".vcd", sizeof( loadfile ) ); @@ -846,6 +899,7 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename ) delete[] pBuffer; return pScene; +#endif } diff --git a/sp/src/game/server/hl2/hl2_player.cpp b/sp/src/game/server/hl2/hl2_player.cpp index e7583f5a2..85290830c 100644 --- a/sp/src/game/server/hl2/hl2_player.cpp +++ b/sp/src/game/server/hl2/hl2_player.cpp @@ -160,6 +160,9 @@ bool g_bCacheLegacyFlashlightStatus = true; bool g_bUseLegacyFlashlight; bool Flashlight_UseLegacyVersion( void ) { +#if defined ( MOP_DLL ) + return true; +#else // If this is the first run through, cache off what the answer should be (cannot change during a session) if ( g_bCacheLegacyFlashlightStatus ) { @@ -176,6 +179,7 @@ bool Flashlight_UseLegacyVersion( void ) // Return the results return g_bUseLegacyFlashlight; +#endif } //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/sceneentity.cpp b/sp/src/game/server/sceneentity.cpp index 495aa0044..2d49b0d82 100644 --- a/sp/src/game/server/sceneentity.cpp +++ b/sp/src/game/server/sceneentity.cpp @@ -3345,6 +3345,50 @@ bool CSceneEntity::ShouldNetwork() const CChoreoScene *CSceneEntity::LoadScene( const char *filename, IChoreoEventCallback *pCallback ) { +#if defined ( MOP_DLL ) + DevMsg(2, "Blocking load of scene from '%s'\n", filename); + + char loadfile[MAX_PATH]; + Q_strncpy( loadfile, filename, sizeof( loadfile ) ); + Q_SetExtension( loadfile, ".vcd", sizeof( loadfile ) ); + Q_FixSlashes( loadfile ); + + void *pBuffer = 0; + CChoreoScene *pScene = NULL; + + int fileSize = filesystem->ReadFileEx( loadfile, "MOD", &pBuffer, true ); + if (fileSize) + { + g_TokenProcessor.SetBuffer((char*)pBuffer); + pScene = ChoreoLoadScene( loadfile, NULL, &g_TokenProcessor, LocalScene_Printf ); + } + else + { + // binary compiled vcd + pScene = new CChoreoScene( NULL ); + if ( !CopySceneFileIntoMemory( loadfile, &pBuffer, &fileSize ) ) + { + MissingSceneWarning( loadfile ); + return NULL; + } + CUtlBuffer buf( pBuffer, fileSize, CUtlBuffer::READ_ONLY ); + if ( !pScene->RestoreFromBinaryBuffer( buf, loadfile, &g_ChoreoStringPool ) ) + { + Warning( "CSceneEntity::LoadScene: Unable to load scene '%s'\n", loadfile ); + delete pScene; + pScene = NULL; + } + } + + if (pScene) + { + pScene->SetPrintFunc(LocalScene_Printf); + pScene->SetEventCallbackInterface(pCallback); + } + + FreeSceneFileMemory(pBuffer); + return pScene; +#else DevMsg( 2, "Blocking load of scene from '%s'\n", filename ); char loadfile[MAX_PATH]; @@ -3377,6 +3421,7 @@ CChoreoScene *CSceneEntity::LoadScene( const char *filename, IChoreoEventCallbac FreeSceneFileMemory( pBuffer ); return pScene; +#endif } CChoreoScene *BlockingLoadScene( const char *filename )