mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 23:43:10 +00:00
Some portrait-related changes, to be used when portrait loading/unloading is done. Also, added a comment on where the class is used
svn-id: r47251
This commit is contained in:
parent
6a07bbd5f4
commit
6d53dfe917
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user