[Scummvm-cvs-logs] SF.net SVN: scummvm:[33894] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Fri Aug 15 10:44:41 CEST 2008
Revision: 33894
http://scummvm.svn.sourceforge.net/scummvm/?rev=33894&view=rev
Author: peres001
Date: 2008-08-15 08:44:41 +0000 (Fri, 15 Aug 2008)
Log Message:
-----------
Updated layer calculation: animations are now hidden properly by background elements (but not items yet).
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/debug.cpp
scummvm/trunk/engines/parallaction/exec_ns.cpp
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/objects.cpp
scummvm/trunk/engines/parallaction/objects.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parser_br.cpp
Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/debug.cpp 2008-08-15 08:44:41 UTC (rev 33894)
@@ -187,19 +187,19 @@
const char *objType[] = { "DOOR", "GET", "ANIM" };
- DebugPrintf("+--------------------+-----+-----+-----+-----+--------+--------+\n"
- "| name | x | y | z | f | type | visi |\n"
- "+--------------------+-----+-----+-----+-----+--------+--------+\n");
+ DebugPrintf("+--------------------+-----+-----+-----+-------+-----+--------+--------+\n"
+ "| name | x | y | z | layer | f | type | visi |\n"
+ "+--------------------+-----+-----+-----+-------+-----+--------+--------+\n");
GfxObjList::iterator b = _vm->_gfx->_gfxobjList.begin();
GfxObjList::iterator e = _vm->_gfx->_gfxobjList.end();
for ( ; b != e; b++) {
GfxObj *obj = *b;
- DebugPrintf("|%-20s|%5i|%5i|%5i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->frame, objType[obj->type], obj->isVisible() );
+ DebugPrintf("|%-20s|%5i|%5i|%5i|%7i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->layer, obj->frame, objType[obj->type], obj->isVisible() );
}
- DebugPrintf("+--------------------+-----+-----+-----+-----+--------+--------+\n");
+ DebugPrintf("+--------------------+-----+-----+-----+-------+-----+--------+--------+\n");
return true;
}
Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp 2008-08-15 08:44:41 UTC (rev 33894)
@@ -330,12 +330,21 @@
if (anim->_flags & kFlagsNoMasked)
layer = LAYER_FOREGROUND;
- else
- layer = _gfx->_backgroundInfo->getLayer(anim->getY() + anim->height());
+ else {
+ if (getGameType() == GType_Nippon) {
+ // Layer in NS depends on where the animation is on the screen, for each animation.
+ layer = _gfx->_backgroundInfo->getLayer(anim->getFrameY() + anim->height());
+ } else {
+ // Layer in BRA is calculated from Z value. For characters it is the same as NS,
+ // but other animations can have Z set from scripts independently from their
+ // position on the screen.
+ layer = _gfx->_backgroundInfo->getLayer(anim->getZ());
+ }
+ }
if (obj) {
_gfx->showGfxObj(obj, true);
- obj->frame = anim->getF();
+ obj->frame = anim->getF();
obj->x = anim->getX();
obj->y = anim->getY();
obj->z = anim->getZ();
@@ -401,7 +410,7 @@
AnimationPtr a = (*it)->_anim;
if (a->_flags & kFlagsCharacter)
- a->setZ(a->getY() + a->height());
+ a->setZ(a->getFrameY() + a->height());
if ((a->_flags & kFlagsActing) == 0)
continue;
@@ -409,7 +418,7 @@
runScript(*it, a);
if (a->_flags & kFlagsCharacter)
- a->setZ(a->getY() + a->height());
+ a->setZ(a->getFrameY() + a->height());
}
_modCounter++;
@@ -671,7 +680,7 @@
if (z->_flags & kFlagsRemove) continue;
Common::Rect r;
- z->getRect(r);
+ z->getBox(r);
r.right++; // adjust border because Common::Rect doesn't include bottom-right edge
r.bottom++;
@@ -701,13 +710,13 @@
if (z->getX() != -1)
continue;
- if (_si < _char._ani->getX())
+ if (_si < _char._ani->getFrameX())
continue;
- if (_si > (_char._ani->getX() + _char._ani->width()))
+ if (_si > (_char._ani->getFrameX() + _char._ani->width()))
continue;
- if (_di < _char._ani->getY())
+ if (_di < _char._ani->getFrameY())
continue;
- if (_di > (_char._ani->getY() + _char._ani->height()))
+ if (_di > (_char._ani->getFrameY() + _char._ani->height()))
continue;
}
@@ -729,8 +738,8 @@
AnimationPtr a = *ait;
_a = (a->_flags & kFlagsActive) ? 1 : 0; // _a: active Animation
- _e = ((_si >= a->getX() + a->width()) || (_si <= a->getX())) ? 0 : 1; // _e: horizontal range
- _f = ((_di >= a->getY() + a->height()) || (_di <= a->getY())) ? 0 : 1; // _f: vertical range
+ _e = ((_si >= a->getFrameX() + a->width()) || (_si <= a->getFrameX())) ? 0 : 1; // _e: horizontal range
+ _f = ((_di >= a->getFrameY() + a->height()) || (_di <= a->getFrameY())) ? 0 : 1; // _f: vertical range
_b = ((type != 0) || (a->_type == kZoneYou)) ? 0 : 1; // _b: (no type specified) AND (Animation is not the character)
_c = (a->_type & 0xFFFF0000) ? 0 : 1; // _c: Animation is not an object
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2008-08-15 08:44:41 UTC (rev 33894)
@@ -377,6 +377,12 @@
*data++ = _backgroundInfo->mask.getValue(x, y);
}
}
+#if 1
+ Common::DumpFile dump;
+ dump.open("maskdump.bin");
+ dump.write(_bitmapMask.pixels, _bitmapMask.w * _bitmapMask.h);
+ dump.close();
+#endif
break;
}
}
Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/objects.cpp 2008-08-15 08:44:41 UTC (rev 33894)
@@ -71,6 +71,20 @@
return r.height();
}
+int16 Animation::getFrameX() const {
+ if (!gfxobj) return _left;
+ Common::Rect r;
+ gfxobj->getRect(_frame, r);
+ return r.left + _left;
+}
+
+int16 Animation::getFrameY() const {
+ if (!gfxobj) return _top;
+ Common::Rect r;
+ gfxobj->getRect(_frame, r);
+ return r.top + _top;
+}
+
uint16 Animation::getFrameNum() const {
if (!gfxobj) return 0;
return gfxobj->getNum();
@@ -198,13 +212,6 @@
free(_linkedName);
}
-void Zone::getRect(Common::Rect& r) const {
- r.left = _left;
- r.right = _right;
- r.top = _top;
- r.bottom = _bottom;
-}
-
void Zone::translate(int16 x, int16 y) {
_left += x;
_right += x;
Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/objects.h 2008-08-15 08:44:41 UTC (rev 33894)
@@ -322,7 +322,6 @@
Zone();
virtual ~Zone();
- void getRect(Common::Rect& r) const;
void translate(int16 x, int16 y);
virtual uint16 width() const;
virtual uint16 height() const;
@@ -334,6 +333,14 @@
_bottom = bottom;
}
+ void getBox(Common::Rect& r) {
+ r.left = getX();
+ r.right = getX() + width();
+ r.top = getY();
+ r.bottom = getY() + height();
+ }
+
+
// getters/setters
virtual int16 getX() { return _left; }
virtual void setX(int16 value) { _left = value; }
@@ -513,6 +520,9 @@
void validateScriptVars();
+ int16 getFrameX() const;
+ int16 getFrameY() const;
+
// getters/setters used by scripts
int16 getX() { return _left; }
void setX(int16 value) { _left = value; }
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2008-08-15 08:44:41 UTC (rev 33894)
@@ -352,7 +352,7 @@
if (_input->_inputMode == Input::kInputModeGame) {
_programExec->runScripts(_location._programs.begin(), _location._programs.end());
- _char._ani->setZ(_char._ani->height() + _char._ani->getY());
+ _char._ani->setZ(_char._ani->height() + _char._ani->getFrameY());
if (_char._ani->gfxobj) {
_char._ani->gfxobj->z = _char._ani->getZ();
}
Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp 2008-08-15 07:10:23 UTC (rev 33893)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp 2008-08-15 08:44:41 UTC (rev 33894)
@@ -466,9 +466,10 @@
debugC(7, kDebugParser, "LOCATION_PARSER(mask) ");
ctxt.maskName = strdup(_tokens[1]);
- ctxt.info->layers[0] = atoi(_tokens[2]);
- ctxt.info->layers[1] = atoi(_tokens[3]);
- ctxt.info->layers[2] = atoi(_tokens[4]);
+ ctxt.info->layers[0] = 0;
+ ctxt.info->layers[1] = atoi(_tokens[2]);
+ ctxt.info->layers[2] = atoi(_tokens[3]);
+ ctxt.info->layers[3] = atoi(_tokens[4]);
}
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