diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/disk.h | 28 | ||||
-rw-r--r-- | engines/parallaction/disk_br.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 26 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 74 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 11 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 30 | ||||
-rw-r--r-- | engines/parallaction/objects.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/objects.h | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 15 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 9 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 9 |
13 files changed, 117 insertions, 109 deletions
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 6adab69f51..f6bb87d247 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -56,10 +56,10 @@ public: virtual Script* loadScript(const char* name) = 0; virtual Frames* loadTalk(const char *name) = 0; virtual Frames* loadObjects(const char *name) = 0; - virtual Graphics::Surface* loadPointer(const char *name) = 0; - virtual Graphics::Surface* loadHead(const char* name) = 0; + virtual Frames* loadPointer(const char *name) = 0; + virtual Frames* loadHead(const char* name) = 0; virtual Font* loadFont(const char* name) = 0; - virtual Graphics::Surface* loadStatic(const char* name) = 0; + virtual Frames* loadStatic(const char* name) = 0; virtual Frames* loadFrames(const char* name) = 0; virtual void loadSlide(BackgroundInfo& info, const char *filename) = 0; virtual void loadScenery(BackgroundInfo& info, const char* background, const char* mask, const char* path) = 0; @@ -130,7 +130,7 @@ private: void unpackBackground(Common::ReadStream *stream, byte *screen, byte *mask, byte *path); Cnv* loadExternalCnv(const char *filename); Cnv* loadCnv(const char *filename); - Graphics::Surface *loadExternalStaticCnv(const char *filename); + Frames* loadExternalStaticCnv(const char *filename); void loadBackground(BackgroundInfo& info, const char *filename); void loadMaskAndPath(BackgroundInfo& info, const char *name); void parseDepths(Common::SeekableReadStream &stream); @@ -148,10 +148,10 @@ public: Script* loadScript(const char* name); Frames* loadTalk(const char *name); Frames* loadObjects(const char *name); - Graphics::Surface* loadPointer(const char *name); - Graphics::Surface* loadHead(const char* name); + Frames* loadPointer(const char *name); + Frames* loadHead(const char* name); Font* loadFont(const char* name); - Graphics::Surface* loadStatic(const char* name); + Frames* loadStatic(const char* name); Frames* loadFrames(const char* name); void loadSlide(BackgroundInfo& info, const char *filename); void loadScenery(BackgroundInfo& info, const char* background, const char* mask, const char* path); @@ -164,7 +164,7 @@ class AmigaDisk_ns : public Disk_ns { protected: Cnv* makeCnv(Common::SeekableReadStream &stream); - Graphics::Surface* makeStaticCnv(Common::SeekableReadStream &stream); + Frames* makeStaticCnv(Common::SeekableReadStream &stream); void patchFrame(byte *dst, byte *dlta, uint16 bytesPerPlane, uint16 height); void unpackFrame(byte *dst, byte *src, uint16 planeSize); void unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 bytesPerPlane, uint16 height); @@ -182,10 +182,10 @@ public: Script* loadScript(const char* name); Frames* loadTalk(const char *name); Frames* loadObjects(const char *name); - Graphics::Surface* loadPointer(const char *name); - Graphics::Surface* loadHead(const char* name); + Frames* loadPointer(const char *name); + Frames* loadHead(const char* name); Font* loadFont(const char* name); - Graphics::Surface* loadStatic(const char* name); + Frames* loadStatic(const char* name); Frames* loadFrames(const char* name); void loadSlide(BackgroundInfo& info, const char *filename); void loadScenery(BackgroundInfo& info, const char* background, const char* mask, const char* path); @@ -220,10 +220,10 @@ public: Script* loadScript(const char* name); Frames* loadTalk(const char *name); Frames* loadObjects(const char *name); - Graphics::Surface* loadPointer(const char *name); - Graphics::Surface* loadHead(const char* name); + Frames* loadPointer(const char *name); + Frames* loadHead(const char* name); Font* loadFont(const char* name); - Graphics::Surface* loadStatic(const char* name); + Frames* loadStatic(const char* name); Frames* loadFrames(const char* name); void loadSlide(BackgroundInfo& info, const char *filename); void loadScenery(BackgroundInfo& info, const char* background, const char* mask, const char* path); diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index c89bc0ddde..aca01e0880 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -166,13 +166,13 @@ Script* DosDisk_br::loadScript(const char* name) { } // there are no Head resources in Big Red Adventure -Graphics::Surface* DosDisk_br::loadHead(const char* name) { +Frames* DosDisk_br::loadHead(const char* name) { debugC(5, kDebugDisk, "DosDisk_br::loadHead"); return 0; } -Graphics::Surface* DosDisk_br::loadPointer(const char *name) { +Frames* DosDisk_br::loadPointer(const char *name) { debugC(5, kDebugDisk, "DosDisk_br::loadPointer"); char path[PATH_LEN]; @@ -193,7 +193,7 @@ Graphics::Surface* DosDisk_br::loadPointer(const char *name) { surf->create(width, height, 1); stream.read(surf->pixels, width * height); - return surf; + return new SurfaceToFrames(surf); } @@ -220,7 +220,7 @@ void genSlidePath(char *path, const char* name) { sprintf(path, "%s.bmp", name); } -Graphics::Surface* DosDisk_br::loadStatic(const char* name) { +Frames* DosDisk_br::loadStatic(const char* name) { debugC(5, kDebugDisk, "DosDisk_br::loadStatic"); return 0; } diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 1ec15c842c..3654d0a336 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -343,7 +343,7 @@ Cnv* DosDisk_ns::loadExternalCnv(const char *filename) { return new Cnv(numFrames, width, height, data); } -Graphics::Surface *DosDisk_ns::loadExternalStaticCnv(const char *filename) { +Frames* DosDisk_ns::loadExternalStaticCnv(const char *filename) { char path[PATH_LEN]; @@ -363,7 +363,7 @@ Graphics::Surface *DosDisk_ns::loadExternalStaticCnv(const char *filename) { cnv->create(w, h, 1); stream.read(cnv->pixels, w*h); - return cnv; + return new SurfaceToFrames(cnv); } Cnv* DosDisk_ns::loadCnv(const char *filename) { @@ -440,7 +440,7 @@ Script* DosDisk_ns::loadScript(const char* name) { return new Script(new DummyArchiveStream(_resArchive), true); } -Graphics::Surface* DosDisk_ns::loadHead(const char* name) { +Frames* DosDisk_ns::loadHead(const char* name) { char path[PATH_LEN]; @@ -451,7 +451,7 @@ Graphics::Surface* DosDisk_ns::loadHead(const char* name) { } -Graphics::Surface* DosDisk_ns::loadPointer(const char *name) { +Frames* DosDisk_ns::loadPointer(const char *name) { return loadExternalStaticCnv(name); } @@ -471,7 +471,7 @@ Frames* DosDisk_ns::loadObjects(const char *name) { } -Graphics::Surface* DosDisk_ns::loadStatic(const char* name) { +Frames* DosDisk_ns::loadStatic(const char* name) { char path[PATH_LEN]; @@ -493,7 +493,7 @@ Graphics::Surface* DosDisk_ns::loadStatic(const char* name) { Graphics::PackBitsReadStream decoder(_resArchive); decoder.read(cnv->pixels, w*h); - return cnv; + return new SurfaceToFrames(cnv); } Frames* DosDisk_ns::loadFrames(const char* name) { @@ -937,7 +937,7 @@ void AmigaDisk_ns::unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 b } -Graphics::Surface* AmigaDisk_ns::makeStaticCnv(Common::SeekableReadStream &stream) { +Frames* AmigaDisk_ns::makeStaticCnv(Common::SeekableReadStream &stream) { stream.skip(1); uint16 width = stream.readByte(); @@ -958,7 +958,7 @@ Graphics::Surface* AmigaDisk_ns::makeStaticCnv(Common::SeekableReadStream &strea free(buf); - return cnv; + return new SurfaceToFrames(cnv); } Cnv* AmigaDisk_ns::makeCnv(Common::SeekableReadStream &stream) { @@ -1017,7 +1017,7 @@ Script* AmigaDisk_ns::loadScript(const char* name) { return new Script(new DummyArchiveStream(_resArchive), true); } -Graphics::Surface* AmigaDisk_ns::loadPointer(const char* name) { +Frames* AmigaDisk_ns::loadPointer(const char* name) { debugC(1, kDebugDisk, "AmigaDisk_ns::loadPointer"); Common::File stream; @@ -1027,11 +1027,11 @@ Graphics::Surface* AmigaDisk_ns::loadPointer(const char* name) { return makeStaticCnv(stream); } -Graphics::Surface* AmigaDisk_ns::loadStatic(const char* name) { +Frames* AmigaDisk_ns::loadStatic(const char* name) { debugC(1, kDebugDisk, "AmigaDisk_ns::loadStatic '%s'", name); Common::SeekableReadStream *s = openArchivedFile(name, true); - Graphics::Surface *cnv = makeStaticCnv(*s); + Frames *cnv = makeStaticCnv(*s); delete s; @@ -1285,14 +1285,14 @@ Frames* AmigaDisk_ns::loadFrames(const char* name) { return cnv; } -Graphics::Surface* AmigaDisk_ns::loadHead(const char* name) { +Frames* AmigaDisk_ns::loadHead(const char* name) { debugC(1, kDebugDisk, "AmigaDisk_ns::loadHead '%s'", name); char path[PATH_LEN]; sprintf(path, "%s.head", name); Common::SeekableReadStream *s = openArchivedFile(path, true); - Graphics::Surface *cnv = makeStaticCnv(*s); + Frames *cnv = makeStaticCnv(*s); delete s; diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 1545dc9d07..1c63d78ac3 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -482,53 +482,29 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { // ZONE TYPE: EXAMINE // -// displays character head commenting an examined object -// -void Parallaction::displayCharacterComment(ExamineData *data) { - if (data->_description == NULL) return; +void Parallaction::displayComment(ExamineData *data) { + if (!data->_description) { + return; + } - _gfx->setDialogueBalloon(data->_description, 140, 10, 130, 0, 0); - _gfx->setItem(_char._talk, 190, 80); - _gfx->setItemFrame(0, 0); + if (data->_filename) { + _gfx->setHalfbriteMode(true); + _gfx->setDialogueBalloon(data->_description, 0, 90, 130, 0, 0); + Common::Rect r; + data->_cnv->getRect(0, r); + _gfx->setItem(data->_cnv, 140, (_screenHeight - r.height())/2); + _gfx->setItemFrame(0, 0); + _gfx->setItem(_char._head, 100, 152); + _gfx->setItemFrame(1, 0); + } else { + _gfx->setDialogueBalloon(data->_description, 140, 10, 130, 0, 0); + _gfx->setItem(_char._talk, 190, 80); + _gfx->setItemFrame(0, 0); + } _inputMode = kInputModeComment; } -// display detail view of an item (and eventually comments) -// -void Parallaction::displayItemComment(ExamineData *data) { - - if (data->_description == NULL) return; - - _gfx->setHalfbriteMode(true); - - char v68[PATH_LEN]; - strcpy(v68, data->_filename); - data->_cnv = _disk->loadStatic(v68); - _gfx->flatBlitCnv(data->_cnv, 140, (_screenHeight - data->_cnv->h)/2, Gfx::kBitFront); - delete data->_cnv; - - int16 v6A = 0, v6C = 0; - - _gfx->setFont(_dialogueFont); - _gfx->getStringExtent(data->_description, 130, &v6C, &v6A); - Common::Rect r(v6C, v6A); - r.moveTo(0, 90); - _gfx->drawBalloon(r, 0); - _gfx->flatBlitCnv(_char._head, 100, 152, Gfx::kBitFront); - _gfx->displayWrappedString(data->_description, 0, 90, 0, 130); - - _gfx->updateScreen(); - - waitUntilLeftClick(); - - _gfx->setHalfbriteMode(false); - _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); - _gfx->updateScreen(); - - return; -} - uint16 Parallaction::runZone(Zone *z) { @@ -540,11 +516,7 @@ uint16 Parallaction::runZone(Zone *z) { switch(subtype) { case kZoneExamine: - if (z->u.examine->_filename) { - displayItemComment(z->u.examine); - } else { - displayCharacterComment(z->u.examine); - } + displayComment(z->u.examine); break; case kZoneGet: @@ -631,7 +603,9 @@ void Parallaction_ns::jobRemovePickedItem(void *parm, Job *j) { static uint16 count = 0; if (z->u.get->_cnv) { - Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv->w, z->_top + z->u.get->_cnv->h); + Common::Rect r; + z->u.get->_cnv->getRect(0, r); + r.moveTo(z->_left, z->_top); _gfx->restoreGetBackground(r, z->u.get->_backup); } @@ -655,8 +629,8 @@ void Parallaction_ns::jobDisplayDroppedItem(void *parm, Job *j) { _gfx->backupGetBackground(z->u.get, z->_left, z->_top); } - _gfx->flatBlitCnv(z->u.get->_cnv, z->_left, z->_top, Gfx::kBitBack); - _gfx->flatBlitCnv(z->u.get->_cnv, z->_left, z->_top, Gfx::kBit2); + _gfx->flatBlitCnv(z->u.get->_cnv, 0, z->_left, z->_top, Gfx::kBitBack); + _gfx->flatBlitCnv(z->u.get->_cnv, 0, z->_left, z->_top, Gfx::kBit2); } j->_count++; diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index e40d954f10..41f818a8a8 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -565,14 +565,17 @@ void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) { void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) { - byte *t = (byte*)data->_cnv->pixels; + byte *t = (byte*)data->_cnv->getData(0); byte *s = (byte*)_buffers[kBitBack]->getBasePtr(x, y); byte *d = data->_backup; - uint pitch = _backgroundWidth - data->_cnv->w; + Common::Rect r; + data->_cnv->getRect(0, r); + + uint pitch = _backgroundWidth - r.width(); - for (uint16 i = 0; i < data->_cnv->h ; i++) { - for (uint16 j = 0; j < data->_cnv->w ; j++) { + for (uint16 i = 0; i < r.height(); i++) { + for (uint16 j = 0; j < r.width(); j++) { *d = (*t) ? *s : 0; d++; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 2bc17f0b77..7eacff4f5d 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -84,6 +84,36 @@ struct Frames { }; +struct SurfaceToFrames : public Frames { + + Graphics::Surface *_surf; + +public: + SurfaceToFrames(Graphics::Surface *surf) : _surf(surf) { + } + + ~SurfaceToFrames() { + delete _surf; + } + + uint16 getNum() { + return 1; + } + byte* getData(uint16 index) { + assert(index == 0); + return (byte*)_surf->getBasePtr(0,0); + } + void getRect(uint16 index, Common::Rect &r) { + assert(index == 0); + r.left = 0; + r.top = 0; + r.setWidth(_surf->w); + r.setHeight(_surf->h); + } + + +}; + struct Cnv : public Frames { uint16 _count; // # of frames uint16 _width; // diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index 0d46568106..93ebca5ff1 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -131,6 +131,7 @@ Zone::~Zone() { case kZoneExamine: free(u.examine->_filename); free(u.examine->_description); + delete u.examine->_cnv; delete u.examine; break; @@ -148,10 +149,7 @@ Zone::~Zone() { case kZoneGet: free(u.get->_backup); - if (u.get->_cnv) { - u.get->_cnv->free(); - delete u.get->_cnv; - } + delete u.get->_cnv; delete u.get; break; diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index fdbe062e8b..c62dedc829 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -170,7 +170,7 @@ struct Dialogue { struct GetData { // size = 24 uint32 _icon; - Graphics::Surface *_cnv; + Frames *_cnv; byte *_backup; uint16 field_14; // unused uint16 field_16; // unused @@ -191,7 +191,7 @@ struct SpeakData { // size = 36 } }; struct ExamineData { // size = 28 - Graphics::Surface *_cnv; + Frames *_cnv; uint16 _opBase; // unused uint16 field_12; // unused char* _description; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 5031e7be22..1bbe06984b 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -432,6 +432,8 @@ void Parallaction::updateCommentInput() { waitUntilLeftClick(); _gfx->hideDialogueStuff(); + _gfx->setHalfbriteMode(false); + _inputMode = kInputModeGame; } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index f6749d908f..521aa634b5 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -213,7 +213,7 @@ struct Character { Animation _ani; - Graphics::Surface *_head; + Frames *_head; Frames *_talk; Frames *_objs; PathBuilder _builder; @@ -558,8 +558,7 @@ protected: // members void freeLocation(); void showLocationComment(const char *text, bool end); - void displayCharacterComment(ExamineData *data); - void displayItemComment(ExamineData *data); + void displayComment(ExamineData *data); uint16 checkDoor(); @@ -705,7 +704,7 @@ private: void initCursors(); static byte _mouseArrow[256]; - Graphics::Surface *_mouseComposedArrow; + Frames *_mouseComposedArrow; static const Callable _dosCallables[25]; static const Callable _amigaCallables[25]; @@ -1002,10 +1001,10 @@ private: void setMousePointer(int16 index); void initCursors(); - Graphics::Surface *_dinoCursor; - Graphics::Surface *_dougCursor; - Graphics::Surface *_donnaCursor; - Graphics::Surface *_mouseArrow; + Frames *_dinoCursor; + Frames *_dougCursor; + Frames *_donnaCursor; + Frames *_mouseArrow; int showMenu(); diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 232e08799e..b832b50fd9 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -92,10 +92,6 @@ int Parallaction_br::init() { Parallaction_br::~Parallaction_br() { freeFonts(); - _dinoCursor->free(); - _dougCursor->free(); - _donnaCursor->free(); - delete _dinoCursor; delete _dougCursor; delete _donnaCursor; @@ -308,7 +304,10 @@ void Parallaction_br::initCursors() { void Parallaction_br::setMousePointer(int16 index) { - _system->setMouseCursor((byte*)_mouseArrow->pixels, _mouseArrow->w, _mouseArrow->h, 0, 0, 0); + Common::Rect r; + _mouseArrow->getRect(0, r); + + _system->setMouseCursor(_mouseArrow->getData(0), r.width(), r.height(), 0, 0, 0); _system->showMouse(true); } diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index b810ff7da7..6541498988 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -146,10 +146,8 @@ int Parallaction_ns::init() { Parallaction_ns::~Parallaction_ns() { freeFonts(); - _mouseComposedArrow->free(); delete _mouseComposedArrow; - delete _commandsNames; delete _instructionNames; delete _locationStmt; @@ -223,7 +221,7 @@ void Parallaction_ns::setInventoryCursor(int pos) { _activeItem._id = item->_id; - byte *v8 = (byte*)_mouseComposedArrow->pixels; + byte *v8 = _mouseComposedArrow->getData(0); // FIXME: destination offseting is not clear byte* s = _char._objs->getData(item->_index); diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 35f6f20346..9681d67a8b 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -1275,11 +1275,15 @@ void Parallaction_ns::parseGetData(Script &script, Zone *z) { if (!scumm_stricmp(_tokens[0], "file")) { data->_cnv = _disk->loadStatic(_tokens[1]); - data->_backup = (byte*)malloc(data->_cnv->w*data->_cnv->h); + + Common::Rect r; + data->_cnv->getRect(0, r); + + data->_backup = (byte*)malloc(r.width() * r.height()); if ((z->_flags & kFlagsRemove) == 0) { _gfx->backupGetBackground(data, z->_left, z->_top); - _gfx->flatBlitCnv(data->_cnv, z->_left, z->_top, Gfx::kBitBack); + _gfx->flatBlitCnv(data->_cnv, 0, z->_left, z->_top, Gfx::kBitBack); } } @@ -1303,6 +1307,7 @@ void Parallaction_ns::parseExamineData(Script &script, Zone *z) { if (!scumm_stricmp(_tokens[0], "file")) { data->_filename = strdup(_tokens[1]); + data->_cnv = _disk->loadStatic(_tokens[1]); } if (!scumm_stricmp(_tokens[0], "desc")) { data->_description = parseComment(script); |