mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 17:20:30 +00:00
A bit of cleanup.
This commit is contained in:
parent
0f3f852c31
commit
cb86bc7892
@ -305,9 +305,6 @@ Bitmap::~Bitmap() {
|
||||
g_grim->killBitmap(this);
|
||||
}
|
||||
|
||||
void Bitmap::restoreState(SaveGame *state) {
|
||||
}
|
||||
|
||||
void BitmapData::convertToColorFormat(int num, int format) {
|
||||
// Supports 1555->RGBA, RGBA->565
|
||||
unsigned char red = 0, green = 0, blue = 0, alpha = 0;
|
||||
|
@ -70,8 +70,6 @@ public:
|
||||
Bitmap(const char *data, int width, int height, int bpp, const char *filename);
|
||||
Bitmap();
|
||||
|
||||
void restoreState(SaveGame *state);
|
||||
|
||||
const Common::String &getFilename() const { return _data->_fname; }
|
||||
|
||||
void draw() const;
|
||||
|
69
engines/grim/color.cpp
Normal file
69
engines/grim/color.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/* Residual - A 3D game interpreter
|
||||
*
|
||||
* Residual is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/grim/color.h"
|
||||
#include "engines/grim/savegame.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
Color::Color(byte r, byte g, byte b) :
|
||||
Object() {
|
||||
_vals[0] = r;
|
||||
_vals[1] = g;
|
||||
_vals[2] = b;
|
||||
}
|
||||
|
||||
Color::Color(const Color& c) :
|
||||
Object() {
|
||||
_vals[0] = c._vals[0];
|
||||
_vals[1] = c._vals[1];
|
||||
_vals[2] = c._vals[2];
|
||||
}
|
||||
|
||||
Color& Color::operator =(const Color &c) {
|
||||
_vals[0] = c._vals[0];
|
||||
_vals[1] = c._vals[1];
|
||||
_vals[2] = c._vals[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
Color& Color::operator =(Color *c) {
|
||||
_vals[0] = c->_vals[0];
|
||||
_vals[1] = c->_vals[1];
|
||||
_vals[2] = c->_vals[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Color::restoreState(SaveGame *state) {
|
||||
getRed() = state->readByte();
|
||||
getGreen() = state->readByte();
|
||||
getBlue() = state->readByte();
|
||||
}
|
||||
|
||||
void Color::saveState(SaveGame *state) {
|
||||
state->writeByte(getRed());
|
||||
state->writeByte(getGreen());
|
||||
state->writeByte(getBlue());
|
||||
}
|
||||
|
||||
} // end of namespace Grim
|
||||
|
@ -1151,22 +1151,13 @@ void GrimEngine::savegameRestore() {
|
||||
g_movie->pause(true);
|
||||
|
||||
// free all resource
|
||||
killColors();
|
||||
killBitmaps();
|
||||
killFonts();
|
||||
killObjectStates();
|
||||
killScenes();
|
||||
killTextObjects();
|
||||
killPrimitiveObjects();
|
||||
killActors();
|
||||
|
||||
// lock resources
|
||||
|
||||
_selectedActor = NULL;
|
||||
_talkingActor = NULL;
|
||||
//if (_currScene)
|
||||
// removeScene(_currScene);
|
||||
//delete _currScene;
|
||||
if (_currScene)
|
||||
removeScene(_currScene);
|
||||
delete _currScene;
|
||||
_currScene = NULL;
|
||||
|
||||
restoreColors(_savedState);
|
||||
@ -1281,6 +1272,8 @@ void GrimEngine::restoreObjectStates(SaveGame *state) {
|
||||
void GrimEngine::restoreBitmaps(SaveGame *state) {
|
||||
state->beginSection('VBUF');
|
||||
|
||||
killBitmaps();
|
||||
|
||||
int32 size = state->readLESint32();
|
||||
for (int32 i = 0; i < size; ++i) {
|
||||
int32 id = state->readLEUint32();
|
||||
@ -1304,6 +1297,8 @@ void GrimEngine::restoreBitmaps(SaveGame *state) {
|
||||
void GrimEngine::restoreFonts(SaveGame *state) {
|
||||
state->beginSection('FONT');
|
||||
|
||||
killFonts();
|
||||
|
||||
int32 size = state->readLESint32();
|
||||
for (int32 i = 0; i < size; ++i) {
|
||||
int32 id = state->readLEUint32();
|
||||
|
@ -42,6 +42,7 @@ MODULE_OBJS := \
|
||||
actor.o \
|
||||
bitmap.o \
|
||||
costume.o \
|
||||
color.o \
|
||||
colormap.o \
|
||||
detection.o \
|
||||
font.o \
|
||||
|
Loading…
Reference in New Issue
Block a user