[Scummvm-cvs-logs] SF.net SVN: scummvm: [28760] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Tue Aug 28 16:30:18 CEST 2007
Revision: 28760
http://scummvm.svn.sourceforge.net/scummvm/?rev=28760&view=rev
Author: peres001
Date: 2007-08-28 07:30:17 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Enforced use of character's feet coordinates throughout the walk code.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/parser_ns.cpp
scummvm/trunk/engines/parallaction/walk.cpp
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2007-08-28 10:41:25 UTC (rev 28759)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2007-08-28 14:30:17 UTC (rev 28760)
@@ -259,6 +259,17 @@
_ani._label._text = strdup("yourself");
}
+ void getFoot(Common::Point &foot) {
+ foot.x = _ani._left + _ani.width() / 2;
+ foot.y = _ani._top + _ani.height();
+ }
+
+ void setFoot(const Common::Point &foot) {
+ _ani._left = foot.x - _ani.width() / 2;
+ _ani._top = foot.y - _ani.height();
+ }
+
+
};
Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp 2007-08-28 10:41:25 UTC (rev 28759)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp 2007-08-28 14:30:17 UTC (rev 28760)
@@ -920,8 +920,8 @@
if (!scumm_stricmp(_tokens[0], "COORD")) {
WalkNode *v4 = new WalkNode(
- atoi(_tokens[1]) - _char._ani.width()/2,
- atoi(_tokens[2]) - _char._ani.height()
+ atoi(_tokens[1]),
+ atoi(_tokens[2])
);
list.push_front(v4);
Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp 2007-08-28 10:41:25 UTC (rev 28759)
+++ scummvm/trunk/engines/parallaction/walk.cpp 2007-08-28 14:30:17 UTC (rev 28760)
@@ -156,7 +156,7 @@
correctPathPoint(to);
debugC(1, kDebugWalk, "found closest path point at (%i, %i)", to.x, to.y);
- WalkNode *v48 = new WalkNode(to.x - _vm->_char._ani.width() / 2, to.y - _vm->_char._ani.height());
+ WalkNode *v48 = new WalkNode(to.x, to.y);
WalkNode *v44 = new WalkNode(*v48);
uint16 v38 = walkFunc1(to.x, to.y, v44);
@@ -178,7 +178,9 @@
#endif
Common::Point stop(v48->_x, v48->_y);
- Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top);
+ Common::Point pos;
+ _vm->_char.getFoot(pos);
+
uint32 v34 = buildSubPath(pos, stop);
if (v38 != 0 && v34 > v38) {
// no alternative path (gap?)
@@ -216,10 +218,8 @@
Common::Point v4(0, 0);
- Common::Point foot(
- _vm->_char._ani._left + _vm->_char._ani.width()/2,
- _vm->_char._ani._top + _vm->_char._ani.height()
- );
+ Common::Point foot;
+ _vm->_char.getFoot(foot);
Common::Point v8(foot);
@@ -249,8 +249,8 @@
v8 = foot;
}
- Node->_x = v4.x - _vm->_char._ani.width() / 2;
- Node->_y = v4.y - _vm->_char._ani.height();
+ Node->_x = v4.x;
+ Node->_y = v4.y;
return (x - v4.x) * (x - v4.x) + (y - v4.y) * (y - v4.y);
}
@@ -265,19 +265,19 @@
void Parallaction::clipMove(Common::Point& pos, const WalkNode* from) {
- if ((pos.x < from->_x) && (pos.x < _vm->_pathBuffer->w) && (_pathBuffer->getValue(_char._ani.width()/2 + pos.x + 2, _char._ani.height() + pos.y) != 0)) {
+ if ((pos.x < from->_x) && (pos.x < _vm->_pathBuffer->w) && (_pathBuffer->getValue(pos.x + 2, pos.y) != 0)) {
pos.x = (pos.x + 2 < from->_x) ? pos.x + 2 : from->_x;
}
- if ((pos.x > from->_x) && (pos.x > -20) && (_pathBuffer->getValue(_char._ani.width()/2 + pos.x - 2, _char._ani.height() + pos.y) != 0)) {
+ if ((pos.x > from->_x) && (pos.x > 0) && (_pathBuffer->getValue(pos.x - 2, pos.y) != 0)) {
pos.x = (pos.x - 2 > from->_x) ? pos.x - 2 : from->_x;
}
- if ((pos.y < from->_y) && (pos.y < (_vm->_pathBuffer->h - _char._ani.height())) && (_pathBuffer->getValue(_char._ani.width()/2 + pos.x, _char._ani.height() + pos.y + 2) != 0)) {
+ if ((pos.y < from->_y) && (pos.y < _vm->_pathBuffer->h) && (_pathBuffer->getValue(pos.x, pos.y + 2) != 0)) {
pos.y = (pos.y + 2 <= from->_y) ? pos.y + 2 : from->_y;
}
- if ((pos.y > from->_y) && (pos.y > -20) && (_pathBuffer->getValue(_char._ani.width()/2 + pos.x, _char._ani.height() + pos.y- 2) != 0)) {
+ if ((pos.y > from->_y) && (pos.y > 0) && (_pathBuffer->getValue(pos.x, pos.y - 2) != 0)) {
pos.y = (pos.y - 2 >= from->_y) ? pos.y - 2 :from->_y;
}
@@ -335,13 +335,16 @@
}
_engineFlags &= ~kEngineWalking;
- Zone *z = hitZone(kZoneDoor, _char._ani._left + _char._ani.width() / 2, _char._ani._top + _char._ani.height());
+ Common::Point foot;
+
+ _char.getFoot(foot);
+ Zone *z = hitZone(kZoneDoor, foot.x, foot.y);
+
if (z != NULL) {
if ((z->_flags & kFlagsClosed) == 0) {
- _location._startPosition.x = z->u.door->_startPos.x;
- _location._startPosition.y = z->u.door->_startPos.y;
+ _location._startPosition = z->u.door->_startPos;
_location._startFrame = z->u.door->_startFrame;
strcpy(_location._name, z->u.door->_location);
@@ -353,7 +356,8 @@
}
}
- z = hitZone(kZoneTrap, _char._ani._left + _char._ani.width() / 2, _char._ani._top + _char._ani.height());
+ _char.getFoot(foot);
+ z = hitZone(kZoneTrap, foot.x, foot.y);
if (z != NULL) {
_localFlags[_currentLocationIndex] |= kFlagsEnter;
@@ -383,9 +387,12 @@
void jobWalk(void *parm, Job *j) {
WalkNodeList *list = (WalkNodeList*)parm;
- Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top);
- _vm->_char._ani._oldPos = pos;
+ _vm->_char._ani._oldPos.x = _vm->_char._ani._left;
+ _vm->_char._ani._oldPos.y = _vm->_char._ani._top;
+ Common::Point pos;
+ _vm->_char.getFoot(pos);
+
WalkNodeList::iterator it = list->begin();
if (it != list->end()) {
@@ -406,10 +413,11 @@
int16 v16 = _vm->selectWalkFrame(pos, *it);
_vm->clipMove(pos, *it);
- _vm->_char._ani._left = pos.x;
- _vm->_char._ani._top = pos.y;
+ _vm->_char.setFoot(pos);
- if (pos == _vm->_char._ani._oldPos) {
+ Common::Point newpos(_vm->_char._ani._left, _vm->_char._ani._top);
+
+ if (newpos == _vm->_char._ani._oldPos) {
debugC(1, kDebugWalk, "jobWalk was blocked by an unforeseen obstacle");
j->_finished = 1;
_vm->finalizeWalk(list);
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