Fixed support for walking zones in BRA:

* patches are not applied if the zone is not visible when loading 
* when applying a patch, always overwrite the existing data instead of OR'ing

svn-id: r36209
This commit is contained in:
Nicola Mettifogo 2009-02-03 10:42:27 +00:00
parent 0a42482fc3
commit d1b71335d6
4 changed files with 4 additions and 21 deletions

View file

@ -34,7 +34,7 @@ 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), _hasMask(false) {
type(objType), frame(0), layer(3), scale(100), _hasMask(false), _hasPath(false) {
if (name) {
_name = strdup(name);

View file

@ -941,7 +941,7 @@ void BackgroundInfo::togglePathPatch(uint id, int x, int y, bool apply) {
}
PathBuffer *patch = _pathPatches[id];
if (apply) {
_path->bltOr(x, y, *patch, 0, 0, patch->w, patch->h);
_path->bltCopy(x, y, *patch, 0, 0, patch->w, patch->h);
} else {
_path->bltCopy(x, y, _pathBackup, x, y, patch->w, patch->h);
}
@ -1075,23 +1075,6 @@ byte* PathBuffer::getPtr(uint16 x, uint16 y) const {
return data + (x >> 3) + y * internalWidth;
}
void PathBuffer::bltOr(uint16 dx, uint16 dy, const PathBuffer &src, uint16 sx, uint16 sy, uint width, uint height) {
assert((width <= w) && (width <= src.w) && (height <= h) && (height <= src.h));
byte *s = src.getPtr(sx, sy);
byte *d = getPtr(dx, dy);
// this code assumes buffers are aligned on 4-pixels boundaries, as the original does
uint16 linewidth = width >> 3;
for (uint16 i = 0; i < height; i++) {
for (uint16 j = 0; j < linewidth; j++) {
*d++ |= *s++;
}
d += internalWidth - linewidth;
s += src.internalWidth - linewidth;
}
}
void PathBuffer::bltCopy(uint16 dx, uint16 dy, const PathBuffer &src, uint16 sx, uint16 sy, uint width, uint height) {
assert((width <= w) && (width <= src.w) && (height <= h) && (height <= src.h));

View file

@ -218,7 +218,6 @@ struct PathBuffer {
bool bigEndian;
byte* getPtr(uint16 x, uint16 y) const;
void bltOr(uint16 dx, uint16 dy, const PathBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
void bltCopy(uint16 dx, uint16 dy, const PathBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
public:

View file

@ -1258,7 +1258,8 @@ void LocationParser_br::parse(Script *script) {
ZoneList::iterator it = _vm->_location._zones.begin();
for ( ; it != _vm->_location._zones.end(); it++) {
bool visible = ((*it)->_flags & kFlagsRemove) == 0;
_vm->showZone((*it), visible);
if (visible)
_vm->showZone((*it), visible);
}
if (ctxt.characterName) {