aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/graphics/portrait.cpp14
-rw-r--r--engines/sci/graphics/portrait.h11
3 files changed, 18 insertions, 9 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 59f960abd9..048214a4dc 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -648,7 +648,7 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) {
case 0: { // load
if (argc == 2) {
Common::String resourceName = s->_segMan->getString(argv[1]);
- return s->_gui->portraitLoad(resourceName);
+ s->r_acc = s->_gui->portraitLoad(resourceName);
} else {
warning("kPortrait(loadResource) called with unsupported argc %d", argc);
}
diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp
index e2c2a86fde..c45ca914f9 100644
--- a/engines/sci/graphics/portrait.cpp
+++ b/engines/sci/graphics/portrait.cpp
@@ -39,8 +39,8 @@
namespace Sci {
Portrait::Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName)
- : _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio) {
- init(resourceName);
+ : _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) {
+ init();
}
Portrait::~Portrait() {
@@ -48,7 +48,7 @@ Portrait::~Portrait() {
delete _fileData;
}
-void Portrait::init(Common::String resourceName) {
+void Portrait::init() {
// .BIN files are loaded from actors directory and from .\ directory
// header:
// 3 bytes "WIN"
@@ -69,11 +69,11 @@ void Portrait::init(Common::String resourceName) {
// another animation count times bitmap header and data
int32 fileSize = 0;
Common::SeekableReadStream *file =
- SearchMan.createReadStreamForMember("actors/" + resourceName + ".bin");
+ SearchMan.createReadStreamForMember("actors/" + _resourceName + ".bin");
if (!file) {
- file = SearchMan.createReadStreamForMember(resourceName + ".bin");
+ file = SearchMan.createReadStreamForMember(_resourceName + ".bin");
if (!file)
- error("portrait %s.bin not found", resourceName.c_str());
+ error("portrait %s.bin not found", _resourceName.c_str());
}
fileSize = file->size();
_fileData = new byte[fileSize];
@@ -81,7 +81,7 @@ void Portrait::init(Common::String resourceName) {
delete file;
if (strncmp((char *)_fileData, "WIN", 3)) {
- error("portrait %s doesn't have valid header", resourceName.c_str());
+ error("portrait %s doesn't have valid header", _resourceName.c_str());
}
_width = READ_LE_UINT16(_fileData + 3);
_height = READ_LE_UINT16(_fileData + 5);
diff --git a/engines/sci/graphics/portrait.h b/engines/sci/graphics/portrait.h
index dab009bfa1..5053df8b7c 100644
--- a/engines/sci/graphics/portrait.h
+++ b/engines/sci/graphics/portrait.h
@@ -35,6 +35,11 @@ struct PortraitBitmap {
byte *rawBitmap;
};
+/**
+ * This class is used to handle all the hi-res portraits used in the Windows
+ * release of KQ6. These are all in external data files, and handled separately
+ * from the rest of the engine (originally, inside rave.dll)
+ */
class Portrait {
public:
Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName);
@@ -43,8 +48,10 @@ public:
void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
void doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
+ Common::String getResourceName() { return _resourceName; }
+
private:
- void init(Common::String resourceName);
+ void init();
void drawBitmap(uint16 bitmapNr);
void bitsShow();
@@ -62,6 +69,8 @@ private:
uint16 _bitmapCount;
PortraitBitmap *_bitmaps;
+ Common::String _resourceName;
+
byte *_fileData;
Common::Point _position;