aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2008-06-29 09:30:32 +0000
committerNicola Mettifogo2008-06-29 09:30:32 +0000
commitd8645297cd174fbbd7059a317975c45adefaa5e5 (patch)
tree29dcfbe1cbfe7ac8cde0e8545c550fc7f8f956cf
parent7a9e911896885750566a3c21e794823e4527f78a (diff)
downloadscummvm-rg350-d8645297cd174fbbd7059a317975c45adefaa5e5.tar.gz
scummvm-rg350-d8645297cd174fbbd7059a317975c45adefaa5e5.tar.bz2
scummvm-rg350-d8645297cd174fbbd7059a317975c45adefaa5e5.zip
Changed all remaining code to use the GfxObj class to keep frames data. This allows for more uniform processing during rendering, and also fixes the display of dialogue faces for BRA.
svn-id: r32833
-rw-r--r--engines/parallaction/dialogue.cpp6
-rw-r--r--engines/parallaction/disk.h46
-rw-r--r--engines/parallaction/disk_br.cpp28
-rw-r--r--engines/parallaction/disk_ns.cpp42
-rw-r--r--engines/parallaction/gfxbase.cpp12
-rw-r--r--engines/parallaction/graphics.cpp20
-rw-r--r--engines/parallaction/graphics.h10
-rw-r--r--engines/parallaction/gui_br.cpp4
-rw-r--r--engines/parallaction/objects.h2
-rw-r--r--engines/parallaction/parallaction.h6
10 files changed, 93 insertions, 83 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index 903c71907c..3b6c35d3bb 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -51,8 +51,8 @@ class DialogueManager {
bool _askPassword;
bool isNpc;
- Frames *_questioner;
- Frames *_answerer;
+ GfxObj *_questioner;
+ GfxObj *_answerer;
Question *_q;
@@ -229,7 +229,7 @@ void DialogueManager::run() {
answer = 0;
displayQuestion();
-
+
if (_engineFlags & kEngineQuit)
return;
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index b76c66aead..176f10aa10 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -55,13 +55,13 @@ public:
virtual Script* loadLocation(const char *name) = 0;
virtual Script* loadScript(const char* name) = 0;
- virtual Frames* loadTalk(const char *name) = 0;
- virtual Frames* loadObjects(const char *name) = 0;
+ virtual GfxObj* loadTalk(const char *name) = 0;
+ virtual GfxObj* loadObjects(const char *name) = 0;
virtual Frames* loadPointer(const char *name) = 0;
- virtual Frames* loadHead(const char* name) = 0;
+ virtual GfxObj* loadHead(const char* name) = 0;
virtual Font* loadFont(const char* name) = 0;
- virtual Frames* loadStatic(const char* name) = 0;
- virtual Frames* loadFrames(const char* name) = 0;
+ virtual GfxObj* loadStatic(const char* name) = 0;
+ virtual GfxObj* 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;
virtual Table* loadTable(const char* name) = 0;
@@ -147,13 +147,13 @@ public:
Script* loadLocation(const char *name);
Script* loadScript(const char* name);
- Frames* loadTalk(const char *name);
- Frames* loadObjects(const char *name);
+ GfxObj* loadTalk(const char *name);
+ GfxObj* loadObjects(const char *name);
Frames* loadPointer(const char *name);
- Frames* loadHead(const char* name);
+ GfxObj* loadHead(const char* name);
Font* loadFont(const char* name);
- Frames* loadStatic(const char* name);
- Frames* loadFrames(const char* name);
+ GfxObj* loadStatic(const char* name);
+ GfxObj* loadFrames(const char* name);
void loadSlide(BackgroundInfo& info, const char *filename);
void loadScenery(BackgroundInfo& info, const char* background, const char* mask, const char* path);
Table* loadTable(const char* name);
@@ -181,13 +181,13 @@ public:
Script* loadLocation(const char *name);
Script* loadScript(const char* name);
- Frames* loadTalk(const char *name);
- Frames* loadObjects(const char *name);
+ GfxObj* loadTalk(const char *name);
+ GfxObj* loadObjects(const char *name);
Frames* loadPointer(const char *name);
- Frames* loadHead(const char* name);
+ GfxObj* loadHead(const char* name);
Font* loadFont(const char* name);
- Frames* loadStatic(const char* name);
- Frames* loadFrames(const char* name);
+ GfxObj* loadStatic(const char* name);
+ GfxObj* loadFrames(const char* name);
void loadSlide(BackgroundInfo& info, const char *filename);
void loadScenery(BackgroundInfo& info, const char* background, const char* mask, const char* path);
Table* loadTable(const char* name);
@@ -220,13 +220,13 @@ public:
void setLanguage(uint16 language);
Script* loadLocation(const char *name);
Script* loadScript(const char* name);
- Frames* loadTalk(const char *name);
- Frames* loadObjects(const char *name);
+ GfxObj* loadTalk(const char *name);
+ GfxObj* loadObjects(const char *name);
Frames* loadPointer(const char *name);
- Frames* loadHead(const char* name);
+ GfxObj* loadHead(const char* name);
Font* loadFont(const char* name);
- Frames* loadStatic(const char* name);
- Frames* loadFrames(const char* name);
+ GfxObj* loadStatic(const char* name);
+ GfxObj* loadFrames(const char* name);
void loadSlide(BackgroundInfo& info, const char *filename);
void loadScenery(BackgroundInfo& info, const char* name, const char* mask, const char* path);
Table* loadTable(const char* name);
@@ -248,10 +248,10 @@ public:
AmigaDisk_br(Parallaction *vm);
virtual ~AmigaDisk_br();
- Frames* loadTalk(const char *name);
+ GfxObj* loadTalk(const char *name);
Font* loadFont(const char* name);
- Frames* loadStatic(const char* name);
- Frames* loadFrames(const char* name);
+ GfxObj* loadStatic(const char* name);
+ GfxObj* loadFrames(const char* name);
void loadSlide(BackgroundInfo& info, const char *filename);
void loadScenery(BackgroundInfo& info, const char* name, const char* mask, const char* path);
};
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 5e88327879..0159d9d406 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -138,7 +138,7 @@ DosDisk_br::DosDisk_br(Parallaction* vm) : _vm(vm) {
DosDisk_br::~DosDisk_br() {
}
-Frames* DosDisk_br::loadTalk(const char *name) {
+GfxObj* DosDisk_br::loadTalk(const char *name) {
debugC(5, kDebugDisk, "DosDisk_br::loadTalk(%s)", name);
Common::File stream;
@@ -151,7 +151,7 @@ Frames* DosDisk_br::loadTalk(const char *name) {
errorFileNotFound(path);
}
- return createSprites(stream);
+ return new GfxObj(0, createSprites(stream), name);
}
Script* DosDisk_br::loadLocation(const char *name) {
@@ -184,7 +184,7 @@ Script* DosDisk_br::loadScript(const char* name) {
}
// there are no Head resources in Big Red Adventure
-Frames* DosDisk_br::loadHead(const char* name) {
+GfxObj* DosDisk_br::loadHead(const char* name) {
debugC(5, kDebugDisk, "DosDisk_br::loadHead");
return 0;
}
@@ -235,7 +235,7 @@ Font* DosDisk_br::loadFont(const char* name) {
}
-Frames* DosDisk_br::loadObjects(const char *name) {
+GfxObj* DosDisk_br::loadObjects(const char *name) {
debugC(5, kDebugDisk, "DosDisk_br::loadObjects");
return 0;
}
@@ -244,7 +244,7 @@ void genSlidePath(char *path, const char* name) {
sprintf(path, "%s.bmp", name);
}
-Frames* DosDisk_br::loadStatic(const char* name) {
+GfxObj* DosDisk_br::loadStatic(const char* name) {
debugC(5, kDebugDisk, "DosDisk_br::loadStatic");
char path[PATH_LEN];
@@ -256,7 +256,7 @@ Frames* DosDisk_br::loadStatic(const char* name) {
Graphics::Surface *surf = new Graphics::Surface;
loadBitmap(stream, *surf, 0);
- return new SurfaceToFrames(surf);
+ return new GfxObj(0, new SurfaceToFrames(surf), name);
}
Sprites* DosDisk_br::createSprites(Common::ReadStream &stream) {
@@ -280,7 +280,7 @@ Sprites* DosDisk_br::createSprites(Common::ReadStream &stream) {
return sprites;
}
-Frames* DosDisk_br::loadFrames(const char* name) {
+GfxObj* DosDisk_br::loadFrames(const char* name) {
debugC(5, kDebugDisk, "DosDisk_br::loadFrames");
char path[PATH_LEN];
@@ -291,7 +291,7 @@ Frames* DosDisk_br::loadFrames(const char* name) {
errorFileNotFound(path);
- return createSprites(stream);
+ return new GfxObj(0, createSprites(stream), name);
}
// Slides in Nippon Safes are basically screen-sized pictures with valid
@@ -552,7 +552,7 @@ void AmigaDisk_br::loadSlide(BackgroundInfo& info, const char *name) {
return;
}
-Frames* AmigaDisk_br::loadStatic(const char* name) {
+GfxObj* AmigaDisk_br::loadStatic(const char* name) {
debugC(1, kDebugDisk, "AmigaDisk_br::loadStatic '%s'", name);
char path[PATH_LEN];
@@ -570,7 +570,7 @@ Frames* AmigaDisk_br::loadStatic(const char* name) {
free(pal);
- return new SurfaceToFrames(surf);
+ return new GfxObj(0, new SurfaceToFrames(surf));
}
Sprites* AmigaDisk_br::createSprites(const char *path) {
@@ -600,22 +600,22 @@ Sprites* AmigaDisk_br::createSprites(const char *path) {
return sprites;
}
-Frames* AmigaDisk_br::loadFrames(const char* name) {
+GfxObj* AmigaDisk_br::loadFrames(const char* name) {
debugC(1, kDebugDisk, "AmigaDisk_br::loadFrames '%s'", name);
char path[PATH_LEN];
sprintf(path, "%s/anims/%s", _partPath, name);
- return createSprites(path);
+ return new GfxObj(0, createSprites(path));
}
-Frames* AmigaDisk_br::loadTalk(const char *name) {
+GfxObj* AmigaDisk_br::loadTalk(const char *name) {
debugC(1, kDebugDisk, "AmigaDisk_br::loadTalk '%s'", name);
char path[PATH_LEN];
sprintf(path, "%s/talks/%s.tal", _partPath, name);
- return createSprites(path);
+ return new GfxObj(0, createSprites(path));
}
Font* AmigaDisk_br::loadFont(const char* name) {
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index 8f4f6d8e20..f45cf83f56 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -385,12 +385,12 @@ Cnv* DosDisk_ns::loadCnv(const char *filename) {
return new Cnv(numFrames, width, height, data);
}
-Frames* DosDisk_ns::loadTalk(const char *name) {
+GfxObj* DosDisk_ns::loadTalk(const char *name) {
const char *ext = strstr(name, ".talk");
if (ext != NULL) {
// npc talk
- return loadCnv(name);
+ return new GfxObj(0, loadCnv(name), name);
}
@@ -401,7 +401,7 @@ Frames* DosDisk_ns::loadTalk(const char *name) {
sprintf(v20, "%stal", name);
}
- return loadExternalCnv(v20);
+ return new GfxObj(0, loadExternalCnv(v20), name);
}
Script* DosDisk_ns::loadLocation(const char *name) {
@@ -434,14 +434,14 @@ Script* DosDisk_ns::loadScript(const char* name) {
return new Script(new DummyArchiveStream(_resArchive), true);
}
-Frames* DosDisk_ns::loadHead(const char* name) {
+GfxObj* DosDisk_ns::loadHead(const char* name) {
char path[PATH_LEN];
sprintf(path, "%shead", name);
path[8] = '\0';
- return loadExternalStaticCnv(path);
+ return new GfxObj(0, loadExternalStaticCnv(path));
}
@@ -457,15 +457,15 @@ Font* DosDisk_ns::loadFont(const char* name) {
}
-Frames* DosDisk_ns::loadObjects(const char *name) {
+GfxObj* DosDisk_ns::loadObjects(const char *name) {
char path[PATH_LEN];
sprintf(path, "%sobj", name);
- return loadExternalCnv(path);
+ return new GfxObj(0, loadExternalCnv(path), name);
}
-Frames* DosDisk_ns::loadStatic(const char* name) {
+GfxObj* DosDisk_ns::loadStatic(const char* name) {
char path[PATH_LEN];
@@ -487,11 +487,11 @@ Frames* DosDisk_ns::loadStatic(const char* name) {
Graphics::PackBitsReadStream decoder(_resArchive);
decoder.read(cnv->pixels, w*h);
- return new SurfaceToFrames(cnv);
+ return new GfxObj(0, new SurfaceToFrames(cnv), name);
}
-Frames* DosDisk_ns::loadFrames(const char* name) {
- return loadCnv(name);
+GfxObj* DosDisk_ns::loadFrames(const char* name) {
+ return new GfxObj(0, loadCnv(name), name);
}
//
@@ -1025,7 +1025,7 @@ Frames* AmigaDisk_ns::loadPointer(const char* name) {
return makeStaticCnv(stream);
}
-Frames* AmigaDisk_ns::loadStatic(const char* name) {
+GfxObj* AmigaDisk_ns::loadStatic(const char* name) {
debugC(1, kDebugDisk, "AmigaDisk_ns::loadStatic '%s'", name);
Common::SeekableReadStream *s = openArchivedFile(name, true);
@@ -1033,7 +1033,7 @@ Frames* AmigaDisk_ns::loadStatic(const char* name) {
delete s;
- return cnv;
+ return new GfxObj(0, cnv, name);
}
Common::SeekableReadStream *AmigaDisk_ns::openArchivedFile(const char* name, bool errorOnFileNotFound) {
@@ -1258,7 +1258,7 @@ void AmigaDisk_ns::loadSlide(BackgroundInfo& info, const char *name) {
return;
}
-Frames* AmigaDisk_ns::loadFrames(const char* name) {
+GfxObj* AmigaDisk_ns::loadFrames(const char* name) {
debugC(1, kDebugDisk, "AmigaDisk_ns::loadFrames '%s'", name);
Common::SeekableReadStream *s;
@@ -1273,10 +1273,10 @@ Frames* AmigaDisk_ns::loadFrames(const char* name) {
Cnv *cnv = makeCnv(*s);
delete s;
- return cnv;
+ return new GfxObj(0, cnv, name);
}
-Frames* AmigaDisk_ns::loadHead(const char* name) {
+GfxObj* AmigaDisk_ns::loadHead(const char* name) {
debugC(1, kDebugDisk, "AmigaDisk_ns::loadHead '%s'", name);
char path[PATH_LEN];
@@ -1287,11 +1287,11 @@ Frames* AmigaDisk_ns::loadHead(const char* name) {
delete s;
- return cnv;
+ return new GfxObj(0, cnv, name);
}
-Frames* AmigaDisk_ns::loadObjects(const char *name) {
+GfxObj* AmigaDisk_ns::loadObjects(const char *name) {
debugC(1, kDebugDisk, "AmigaDisk_ns::loadObjects");
char path[PATH_LEN];
@@ -1305,11 +1305,11 @@ Frames* AmigaDisk_ns::loadObjects(const char *name) {
Cnv *cnv = makeCnv(*s);
delete s;
- return cnv;
+ return new GfxObj(0, cnv, name);
}
-Frames* AmigaDisk_ns::loadTalk(const char *name) {
+GfxObj* AmigaDisk_ns::loadTalk(const char *name) {
debugC(1, kDebugDisk, "AmigaDisk_ns::loadTalk '%s'", name);
Common::SeekableReadStream *s;
@@ -1328,7 +1328,7 @@ Frames* AmigaDisk_ns::loadTalk(const char *name) {
Cnv *cnv = makeCnv(*s);
delete s;
- return cnv;
+ return new GfxObj(0, cnv, name);
}
Table* AmigaDisk_ns::loadTable(const char* name) {
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index 6599a1f81c..dc28d9d425 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -86,27 +86,27 @@ void GfxObj::clearFlags(uint32 flags) {
}
GfxObj* Gfx::loadAnim(const char *name) {
- Frames *frames = _disk->loadFrames(name);
- GfxObj *obj = new GfxObj(kGfxObjTypeAnim, frames, name);
+ GfxObj *obj = _disk->loadFrames(name);
assert(obj);
+ obj->type = kGfxObjTypeAnim;
return obj;
}
GfxObj* Gfx::loadGet(const char *name) {
- Frames *frames = _disk->loadStatic(name);
- GfxObj *obj = new GfxObj(kGfxObjTypeGet, frames, name);
+ GfxObj *obj = _disk->loadStatic(name);
assert(obj);
+ obj->type = kGfxObjTypeGet;
return obj;
}
GfxObj* Gfx::loadDoor(const char *name) {
- Frames *frames = _disk->loadFrames(name);
- GfxObj *obj = new GfxObj(kGfxObjTypeDoor, frames, name);
+ GfxObj *obj = _disk->loadFrames(name);
assert(obj);
+ obj->type = kGfxObjTypeDoor;
return obj;
}
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 58fb02a750..64edd7babe 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -356,7 +356,17 @@ void Gfx::drawItems() {
Graphics::Surface *surf = g_system->lockScreen();
for (uint i = 0; i < _numItems; i++) {
- blt(_items[i].rect, _items[i].data->getData(_items[i].frame), surf, LAYER_FOREGROUND, _items[i].transparentColor);
+ GfxObj *obj = _items[i].data;
+
+ Common::Rect rect;
+ obj->getRect(obj->frame, rect);
+ rect.translate(obj->x, obj->y);
+
+ if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
+ blt(rect, obj->getData(obj->frame), surf, LAYER_FOREGROUND, _items[i].transparentColor);
+ } else {
+ unpackBlt(rect, obj->getData(obj->frame), obj->getRawSize(obj->frame), surf, LAYER_FOREGROUND, _items[i].transparentColor);
+ }
}
g_system->unlockScreen();
}
@@ -949,7 +959,7 @@ Gfx::~Gfx() {
-int Gfx::setItem(Frames* frames, uint16 x, uint16 y, byte transparentColor) {
+int Gfx::setItem(GfxObj* frames, uint16 x, uint16 y, byte transparentColor) {
int id = _numItems;
_items[id].data = frames;
@@ -965,9 +975,9 @@ int Gfx::setItem(Frames* frames, uint16 x, uint16 y, byte transparentColor) {
void Gfx::setItemFrame(uint item, uint16 f) {
assert(item < _numItems);
- _items[item].frame = f;
- _items[item].data->getRect(f, _items[item].rect);
- _items[item].rect.moveTo(_items[item].x, _items[item].y);
+ _items[item].data->frame = f;
+ _items[item].data->x = _items[item].x;
+ _items[item].data->y = _items[item].y;
}
Gfx::Balloon* Gfx::getBalloon(uint id) {
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index f03b8538b8..c4b0c7b321 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -157,11 +157,11 @@ struct SurfaceToMultiFrames : public Frames {
r.setHeight(_height);
}
uint getRawSize(uint16 index) {
- assert(index == 0);
+ assert(index < _num);
return getSize(index);
}
uint getSize(uint16 index) {
- assert(index == 0);
+ assert(index < _num);
return _width * _height;
}
@@ -487,7 +487,7 @@ public:
void getStringExtent(Font *font, char *text, uint16 maxwidth, int16* width, int16* height);
// other items
- int setItem(Frames* frames, uint16 x, uint16 y, byte transparentColor = 0);
+ int setItem(GfxObj* obj, uint16 x, uint16 y, byte transparentColor = 0);
void setItemFrame(uint item, uint16 f);
void hideDialogueStuff();
void freeBalloons();
@@ -549,7 +549,7 @@ protected:
Graphics::Surface _bitmapMask;
int32 getRenderMode(const char *type);
-protected:
+public:
static int16 _dialogueBalloonX[5];
struct Balloon {
@@ -567,7 +567,7 @@ protected:
uint16 x;
uint16 y;
uint16 frame;
- Frames *data;
+ GfxObj *data;
byte transparentColor;
Common::Rect rect;
diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index c515299a34..5551108693 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -122,7 +122,7 @@ int Parallaction_br::guiShowMenu() {
// TODO: filter menu entries according to progress in game
#define NUM_MENULINES 7
- Frames *_lines[NUM_MENULINES];
+ GfxObj *_lines[NUM_MENULINES];
const char *menuStrings[NUM_MENULINES] = {
"SEE INTRO",
@@ -157,7 +157,7 @@ int Parallaction_br::guiShowMenu() {
int i;
for (i = 0; i < availItems; i++) {
- _lines[i] = guiRenderMenuItem(menuStrings[i]);
+ _lines[i] = new GfxObj(0, guiRenderMenuItem(menuStrings[i]), "MenuItem");
uint id = _gfx->setItem(_lines[i], MENUITEMS_X, MENUITEMS_Y + MENUITEM_HEIGHT * i, 0xFF);
_gfx->setItemFrame(id, 0);
}
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 2bc9df0bbe..44ad35e0ab 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -209,7 +209,7 @@ struct SpeakData { // size = 36
}
};
struct ExamineData { // size = 28
- Frames *_cnv;
+ GfxObj *_cnv;
uint16 _opBase; // unused
uint16 field_12; // unused
char* _description;
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index f9c2c86a1b..b1a5995e28 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -202,9 +202,9 @@ struct Character {
AnimationPtr _ani;
- Frames *_head;
- Frames *_talk;
- Frames *_objs;
+ GfxObj *_head;
+ GfxObj *_talk;
+ GfxObj *_objs;
PathBuilder _builder;
WalkNodeList *_walkPath;