[Scummvm-cvs-logs] SF.net SVN: scummvm:[35447] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sat Dec 20 09:15:09 CET 2008
Revision: 35447
http://scummvm.svn.sourceforge.net/scummvm/?rev=35447&view=rev
Author: peres001
Date: 2008-12-20 08:15:09 +0000 (Sat, 20 Dec 2008)
Log Message:
-----------
Moved mask creation/handling to Gfx.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/gfxbase.cpp
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/objects.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parser_br.cpp
Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp 2008-12-19 21:55:18 UTC (rev 35446)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp 2008-12-20 08:15:09 UTC (rev 35447)
@@ -32,7 +32,10 @@
namespace Parallaction {
-GfxObj::GfxObj(uint objType, Frames *frames, const char* name) : _frames(frames), _keep(true), x(0), y(0), z(0), _flags(kGfxObjNormal), type(objType), frame(0), layer(3), scale(100) {
+GfxObj::GfxObj(uint objType, Frames *frames, const char* name) :
+ _frames(frames), _keep(true), x(0), y(0), z(0), _flags(kGfxObjNormal),
+ type(objType), frame(0), layer(3), scale(100), _hasMask(false) {
+
if (name) {
_name = strdup(name);
} else {
@@ -43,6 +46,7 @@
GfxObj::~GfxObj() {
delete _frames;
free(_name);
+ _mask.free();
}
void GfxObj::release() {
@@ -136,6 +140,14 @@
}
+void Gfx::loadGfxObjMask(const char *name, GfxObj *obj) {
+ Common::Rect rect;
+ obj->getRect(0, rect);
+ obj->_mask.create(rect.width(), rect.height());
+ _vm->_disk->loadMask(_tokens[1], obj->_mask);
+ obj->_hasMask = true;
+}
+
void Gfx::showGfxObj(GfxObj* obj, bool visible) {
if (!obj) {
return;
@@ -146,6 +158,14 @@
} else {
obj->clearFlags(kGfxObjVisible);
}
+
+ if (obj->_hasMask && _backgroundInfo->hasMask) {
+ if (visible) {
+ _backgroundInfo->mask.bltOr(obj->x, obj->y, obj->_mask, 0, 0, obj->_mask.w, obj->_mask.h);
+ } else {
+ _backgroundInfo->mask.bltCopy(obj->x, obj->y, _backgroundInfo->maskBackup, obj->x, obj->y, obj->_mask.w, obj->_mask.h);
+ }
+ }
}
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2008-12-19 21:55:18 UTC (rev 35446)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2008-12-20 08:15:09 UTC (rev 35447)
@@ -803,6 +803,10 @@
setPalette(_backgroundInfo->palette);
}
+ if (_backgroundInfo->hasMask) {
+ _backgroundInfo->maskBackup.clone(_backgroundInfo->mask);
+ }
+
if (_gameType == GType_BRA) {
int width = CLIP(info->width, (int)_vm->_screenWidth, info->width);
int height = CLIP(info->height, (int)_vm->_screenHeight, info->height);
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2008-12-19 21:55:18 UTC (rev 35446)
+++ scummvm/trunk/engines/parallaction/graphics.h 2008-12-20 08:15:09 UTC (rev 35447)
@@ -140,6 +140,15 @@
MaskBuffer() : w(0), internalWidth(0), h(0), size(0), data(0), bigEndian(true) {
}
+ void clone(const MaskBuffer &buf) {
+ if (!buf.data)
+ return;
+
+ create(buf.w, buf.h);
+ bigEndian = buf.bigEndian;
+ memcpy(data, buf.data, size);
+ }
+
void create(uint16 width, uint16 height) {
free();
@@ -378,6 +387,10 @@
uint transparentKey;
uint scale;
+ MaskBuffer _mask;
+ bool _hasMask;
+
+
GfxObj(uint type, Frames *frames, const char *name = NULL);
virtual ~GfxObj();
@@ -413,6 +426,7 @@
Graphics::Surface bg;
MaskBuffer mask;
+ MaskBuffer maskBackup;
PathBuffer path;
Palette palette;
@@ -442,6 +456,7 @@
~BackgroundInfo() {
bg.free();
mask.free();
+ maskBackup.free();
path.free();
x = 0;
y = 0;
@@ -607,6 +622,8 @@
void bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor);
void bltMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
void bltNoMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface *surf, byte transparentColor);
+
+ void loadGfxObjMask(const char *name, GfxObj *obj);
};
Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h 2008-12-19 21:55:18 UTC (rev 35446)
+++ scummvm/trunk/engines/parallaction/objects.h 2008-12-20 08:15:09 UTC (rev 35447)
@@ -193,13 +193,10 @@
struct GetData {
uint32 _icon;
GfxObj *gfxobj;
- MaskBuffer _mask[2];
- bool hasMask;
GetData() {
_icon = 0;
gfxobj = NULL;
- hasMask = false;
}
};
struct SpeakData {
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2008-12-19 21:55:18 UTC (rev 35446)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2008-12-20 08:15:09 UTC (rev 35447)
@@ -521,15 +521,6 @@
if ((z->_type & 0xFFFF) == kZoneGet) {
_gfx->showGfxObj(z->u.get->gfxobj, visible);
-
- GetData *data = z->u.get;
- if (data->hasMask && _gfx->_backgroundInfo->hasMask) {
- if (visible) {
- _gfx->_backgroundInfo->mask.bltOr(data->gfxobj->x, data->gfxobj->y, data->_mask[0], 0, 0, data->_mask->w, data->_mask->h);
- } else {
- _gfx->_backgroundInfo->mask.bltCopy(data->gfxobj->x, data->gfxobj->y, data->_mask[1], 0, 0, data->_mask->w, data->_mask->h);
- }
- }
}
}
Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp 2008-12-19 21:55:18 UTC (rev 35446)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp 2008-12-20 08:15:09 UTC (rev 35447)
@@ -788,13 +788,7 @@
if (!scumm_stricmp(_tokens[0], "mask")) {
if (ctxt.info->hasMask) {
- Common::Rect rect;
- data->gfxobj->getRect(0, rect);
- data->_mask[0].create(rect.width(), rect.height());
- _vm->_disk->loadMask(_tokens[1], data->_mask[0]);
- data->_mask[1].create(rect.width(), rect.height());
- data->_mask[1].bltCopy(0, 0, ctxt.info->mask, data->gfxobj->x, data->gfxobj->y, data->_mask->w, data->_mask->h);
- data->hasMask = true;
+ _vm->_gfx->loadGfxObjMask(_tokens[1], data->gfxobj);
} else {
warning("Mask for zone '%s' ignored, since background doesn't have one", z->_name);
}
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