[Scummvm-cvs-logs] SF.net SVN: scummvm: [29615] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Thu Nov 22 22:51:34 CET 2007
Revision: 29615
http://scummvm.svn.sourceforge.net/scummvm/?rev=29615&view=rev
Author: peres001
Date: 2007-11-22 13:51:33 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
* added adapter from Graphics::Surface to Frames
* changed all Disk routines to return Frames* instead of Graphics::Surface*
* changed displayItemComment to use new gfx routines
* merged code for Examine zones into displayComment
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/disk.h
scummvm/trunk/engines/parallaction/disk_br.cpp
scummvm/trunk/engines/parallaction/disk_ns.cpp
scummvm/trunk/engines/parallaction/exec_ns.cpp
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/objects.cpp
scummvm/trunk/engines/parallaction/objects.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/parallaction_br.cpp
scummvm/trunk/engines/parallaction/parallaction_ns.cpp
scummvm/trunk/engines/parallaction/parser_ns.cpp
Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/disk.h 2007-11-22 21:51:33 UTC (rev 29615)
@@ -56,10 +56,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -166,13 +166,13 @@
}
// 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 @@
surf->create(width, height, 1);
stream.read(surf->pixels, width * height);
- return surf;
+ return new SurfaceToFrames(surf);
}
@@ -220,7 +220,7 @@
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;
}
Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -343,7 +343,7 @@
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 @@
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 @@
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::loadPointer(const char *name) {
+Frames* DosDisk_ns::loadPointer(const char *name) {
return loadExternalStaticCnv(name);
}
@@ -471,7 +471,7 @@
}
-Graphics::Surface* DosDisk_ns::loadStatic(const char* name) {
+Frames* DosDisk_ns::loadStatic(const char* name) {
char path[PATH_LEN];
@@ -493,7 +493,7 @@
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 @@
}
-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 @@
free(buf);
- return cnv;
+ return new SurfaceToFrames(cnv);
}
Cnv* AmigaDisk_ns::makeCnv(Common::SeekableReadStream &stream) {
@@ -1017,7 +1017,7 @@
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 @@
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 @@
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;
Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -482,55 +482,31 @@
// 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) {
debugC(3, kDebugExec, "runZone (%s)", z->_label._text);
@@ -540,11 +516,7 @@
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 @@
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 @@
_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++;
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -565,14 +565,17 @@
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);
- for (uint16 i = 0; i < data->_cnv->h ; i++) {
- for (uint16 j = 0; j < data->_cnv->w ; j++) {
+ uint pitch = _backgroundWidth - r.width();
+
+ for (uint16 i = 0; i < r.height(); i++) {
+ for (uint16 j = 0; j < r.width(); j++) {
*d = (*t) ? *s : 0;
d++;
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/graphics.h 2007-11-22 21:51:33 UTC (rev 29615)
@@ -84,6 +84,36 @@
};
+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; //
Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/objects.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -131,6 +131,7 @@
case kZoneExamine:
free(u.examine->_filename);
free(u.examine->_description);
+ delete u.examine->_cnv;
delete u.examine;
break;
@@ -148,10 +149,7 @@
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;
Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/objects.h 2007-11-22 21:51:33 UTC (rev 29615)
@@ -170,7 +170,7 @@
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 ExamineData { // size = 28
- Graphics::Surface *_cnv;
+ Frames *_cnv;
uint16 _opBase; // unused
uint16 field_12; // unused
char* _description;
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -432,6 +432,8 @@
waitUntilLeftClick();
_gfx->hideDialogueStuff();
+ _gfx->setHalfbriteMode(false);
+
_inputMode = kInputModeGame;
}
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2007-11-22 21:51:33 UTC (rev 29615)
@@ -213,7 +213,7 @@
Animation _ani;
- Graphics::Surface *_head;
+ Frames *_head;
Frames *_talk;
Frames *_objs;
PathBuilder _builder;
@@ -558,8 +558,7 @@
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 @@
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 @@
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();
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -92,10 +92,6 @@
Parallaction_br::~Parallaction_br() {
freeFonts();
- _dinoCursor->free();
- _dougCursor->free();
- _donnaCursor->free();
-
delete _dinoCursor;
delete _dougCursor;
delete _donnaCursor;
@@ -308,7 +304,10 @@
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);
}
Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -146,10 +146,8 @@
Parallaction_ns::~Parallaction_ns() {
freeFonts();
- _mouseComposedArrow->free();
delete _mouseComposedArrow;
-
delete _commandsNames;
delete _instructionNames;
delete _locationStmt;
@@ -223,7 +221,7 @@
_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);
Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp 2007-11-22 21:24:50 UTC (rev 29614)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp 2007-11-22 21:51:33 UTC (rev 29615)
@@ -1275,11 +1275,15 @@
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 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list