mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
CRYOMNI3D: Fix various memory errors
This commit is contained in:
parent
b527b573cf
commit
a2f1700fc3
@ -280,6 +280,12 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
|
||||
Image::BitmapDecoder bmpDecoder;
|
||||
Common::File file;
|
||||
|
||||
Image::ImageDecoder *imageDecoder = _engine->loadHLZ("SOM1.HLZ");
|
||||
if (!imageDecoder) {
|
||||
return "";
|
||||
}
|
||||
const Graphics::Surface *bgFrame = imageDecoder->getSurface();
|
||||
|
||||
for (uint i = 0; i < ARRAYSIZE(categories); i++) {
|
||||
if (!categories[i].bmp) {
|
||||
// No BMP to load
|
||||
@ -296,12 +302,6 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
|
||||
file.close();
|
||||
}
|
||||
|
||||
Image::ImageDecoder *imageDecoder = _engine->loadHLZ("SOM1.HLZ");
|
||||
if (!imageDecoder) {
|
||||
return "";
|
||||
}
|
||||
const Graphics::Surface *bgFrame = imageDecoder->getSurface();
|
||||
|
||||
Graphics::ManagedSurface docSurface;
|
||||
docSurface.create(bgFrame->w, bgFrame->h, bgFrame->format);
|
||||
docSurface.blitFrom(*bgFrame);
|
||||
@ -411,6 +411,10 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
|
||||
|
||||
_engine->showMouse(false);
|
||||
|
||||
for (uint i = 0; i < ARRAYSIZE(categories); i++) {
|
||||
categories[i].highlightedImg.free();
|
||||
}
|
||||
|
||||
delete imageDecoder;
|
||||
|
||||
if (selectedBox == 7) {
|
||||
@ -906,6 +910,12 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
|
||||
Image::BitmapDecoder bmpDecoder;
|
||||
Common::File file;
|
||||
|
||||
Image::ImageDecoder *imageDecoder = _engine->loadHLZ("PLANGR.HLZ");
|
||||
if (!imageDecoder) {
|
||||
return "";
|
||||
}
|
||||
const Graphics::Surface *bgFrame = imageDecoder->getSurface();
|
||||
|
||||
for (uint i = 0; i < ARRAYSIZE(areas); i++) {
|
||||
if (areas[i].bmp) {
|
||||
if (!file.open(areas[i].bmp)) {
|
||||
@ -938,12 +948,6 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
|
||||
boxes.setupBox(ARRAYSIZE(areas), 639 - _sprites->getCursor(105).getWidth(),
|
||||
479 - _sprites->getCursor(105).getHeight(), 640, 480);
|
||||
|
||||
Image::ImageDecoder *imageDecoder = _engine->loadHLZ("PLANGR.HLZ");
|
||||
if (!imageDecoder) {
|
||||
return "";
|
||||
}
|
||||
const Graphics::Surface *bgFrame = imageDecoder->getSurface();
|
||||
|
||||
Graphics::ManagedSurface mapSurface;
|
||||
mapSurface.create(bgFrame->w, bgFrame->h, bgFrame->format);
|
||||
mapSurface.blitFrom(*bgFrame);
|
||||
@ -1052,6 +1056,10 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
|
||||
|
||||
_engine->showMouse(false);
|
||||
|
||||
for (uint i = 0; i < ARRAYSIZE(areas); i++) {
|
||||
areas[i].highlightedImg.free();
|
||||
}
|
||||
|
||||
delete imageDecoder;
|
||||
|
||||
if (selectedBox == ARRAYSIZE(areas)) {
|
||||
@ -1538,6 +1546,8 @@ void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface,
|
||||
|
||||
_fontManager->setupBlock(blockCaption);
|
||||
_fontManager->displayBlockText(caption);
|
||||
|
||||
delete imageDecoder;
|
||||
}
|
||||
|
||||
void Versailles_Documentation::setupRecordBoxes(bool inDocArea, MouseBoxes &boxes) {
|
||||
|
@ -41,7 +41,7 @@ class Versailles_Documentation {
|
||||
public:
|
||||
Versailles_Documentation() : _engine(nullptr), _fontManager(nullptr), _messages(nullptr),
|
||||
_linksData(nullptr), _linksSize(0) { }
|
||||
~Versailles_Documentation() { delete _linksData; }
|
||||
~Versailles_Documentation() { delete [] _linksData; }
|
||||
|
||||
void init(const Sprites *sprites, FontManager *fontManager, const Common::StringArray *messages,
|
||||
CryOmni3DEngine *engine);
|
||||
|
@ -1607,7 +1607,7 @@ void CryOmni3DEngine_Versailles::playInGameVideo(const Common::String &filename,
|
||||
unlockPalette();
|
||||
if (restoreCursorPalette) {
|
||||
// Restore cursors colors as 2 first ones may have been erased by the video
|
||||
setPalette(&_cursorPalette[3 * 240], 240, 248);
|
||||
setPalette(&_cursorPalette[3 * 240], 240, 8);
|
||||
// WORKAROUND: Don't mess with mouse when not restoring cursors palette
|
||||
showMouse(true);
|
||||
}
|
||||
|
@ -1073,6 +1073,8 @@ void CryOmni3DEngine_Versailles::displayCredits() {
|
||||
}
|
||||
}
|
||||
showMouse(true);
|
||||
|
||||
delete imageDecoder;
|
||||
}
|
||||
|
||||
} // End of namespace Versailles
|
||||
|
Loading…
x
Reference in New Issue
Block a user