SLUDGE: Close resources properly in stopMovie()

This commit is contained in:
hax0kartik 2023-03-03 17:51:35 +05:30 committed by Eugene Sandulenko
parent 434d82a9bb
commit a121c1034a
3 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include "sludge/graphics.h"
#include "sludge/freeze.h"
#include "sludge/function.h"
#include "sludge/movie.h"
#include "sludge/newfatal.h"
#include "sludge/objtypes.h"
#include "sludge/region.h"
@ -297,6 +298,8 @@ bool EventManager::handleInput() {
}
if (!tempString.empty()) {
if (isMoviePlaying())
stopMovie();
VariableStack *tempStack = new VariableStack;
if (!checkNew(tempStack))
return false;

View File

@ -93,9 +93,17 @@ int playMovie(int fileNumber) {
return 0;
}
MovieStates isMoviePlaying() {
return movieIsPlaying;
}
int stopMovie() {
int r = movieIsPlaying;
movieIsPlaying = kMovieNothing;
g_sludge->_resMan->finishAccess();
setResourceForFatal(-1);
return r;
}

View File

@ -36,6 +36,7 @@ extern int movieIsEnding;
int playMovie(int fileNumber);
int stopMovie();
MovieStates isMoviePlaying();
int pauseMovie();
} // End of namespace Sludge