[Scummvm-cvs-logs] SF.net SVN: scummvm:[55280] scummvm/trunk/engines/parallaction

tdhs at users.sourceforge.net tdhs at users.sourceforge.net
Tue Jan 18 00:12:59 CET 2011


Revision: 55280
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55280&view=rev
Author:   tdhs
Date:     2011-01-17 23:12:59 +0000 (Mon, 17 Jan 2011)

Log Message:
-----------
PARALLACTION: Minor Whitespace and code complexity reduction in walk.*

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/walk.cpp
    scummvm/trunk/engines/parallaction/walk.h

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2011-01-17 23:00:52 UTC (rev 55279)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2011-01-17 23:12:59 UTC (rev 55280)
@@ -59,11 +59,8 @@
 	{  2,  2,  4,  4 }
 };
 
-
 // adjusts position towards nearest walkable point
-//
 void PathWalker_NS::correctPathPoint(Common::Point &to) {
-
 	if (IS_PATH_CLEAR(to.x, to.y)) return;
 
 	int maxX = _vm->_gfx->_backgroundInfo->_path->w;
@@ -80,7 +77,6 @@
 	right = (right == maxX) ? 1000 : right - to.x;
 	left = (left == 0) ? 1000 : to.x - left;
 
-
 	int16 top = to.y;
 	int16 bottom = to.y;
 	do {
@@ -92,7 +88,6 @@
 	top = (top == 0) ? 1000 : to.y - top;
 	bottom = (bottom == maxY) ? 1000 : bottom - to.y;
 
-
 	int16 closeX = (right >= left) ? left : right;
 	int16 closeY = (top >= bottom) ? bottom : top;
 	int16 close = (closeX >= closeY) ? closeY : closeX;
@@ -108,13 +103,9 @@
 	if (close == bottom) {
 		to.y += bottom;
 	}
-
-	return;
-
 }
 
 uint32 PathWalker_NS::buildSubPath(const Common::Point& pos, const Common::Point& stop) {
-
 	uint32 v28 = 0;
 	uint32 v2C = 0;
 	uint32 v34 = pos.sqrDist(stop);				// square distance from current position and target
@@ -155,12 +146,9 @@
 	}
 
 	return v34;
-
 }
 
-//
 //	x, y: mouse click (foot) coordinates
-//
 void PathWalker_NS::buildPath(AnimationPtr a, uint16 x, uint16 y) {
 	debugC(1, kDebugWalk, "PathBuilder::buildPath to (%i, %i)", x, y);
 
@@ -199,20 +187,14 @@
 
 	buildSubPath(pos, *_walkPath.begin());
 	_walkPath.insert(_walkPath.begin(), _subPath.begin(), _subPath.end());
-
-	return;
 }
 
-
-//
 //	x,y : top left coordinates
 //
 //	0 : Point not reachable
 //	1 : Point reachable in a straight line
 //	other values: square distance to target (point not reachable in a straight line)
-//
 uint16 PathWalker_NS::walkFunc1(const Common::Point &to, Common::Point& node) {
-
 	Common::Point arg(to);
 
 	Common::Point v4;
@@ -229,7 +211,6 @@
 		if (foot.y < to.y && IS_PATH_CLEAR(foot.x, foot.y + 1)) foot.y++;
 		if (foot.y > to.y && IS_PATH_CLEAR(foot.x, foot.y - 1)) foot.y--;
 
-
 		if (foot == v8 && foot != arg) {
 			// foot couldn't move and still away from target
 
@@ -253,7 +234,6 @@
 		}
 
 		v8 = foot;
-
 	}
 
 	// there exists an unobstructed path
@@ -261,7 +241,6 @@
 }
 
 void PathWalker_NS::clipMove(Common::Point& pos, const Common::Point& to) {
-
 	if ((pos.x < to.x) && (pos.x < _vm->_gfx->_backgroundInfo->_path->w) && IS_PATH_CLEAR(pos.x + 2, pos.y)) {
 		pos.x = (pos.x + 2 < to.x) ? pos.x + 2 : to.x;
 	}
@@ -277,13 +256,9 @@
 	if ((pos.y > to.y) && (pos.y > 0) && IS_PATH_CLEAR(pos.x, pos.y - 2)) {
 		pos.y = (pos.y - 2 >= to.y) ? pos.y - 2 : to.y;
 	}
-
-	return;
 }
 
-
 void PathWalker_NS::checkDoor(const Common::Point &foot) {
-
 	ZonePtr z = _vm->hitZone(kZoneDoor, foot.x, foot.y);
 	if (z) {
 		if ((z->_flags & kFlagsClosed) == 0) {
@@ -309,10 +284,8 @@
 		_vm->clearLocationFlags(kFlagsExit);
 		_vm->_zoneTrap.reset();
 	}
-
 }
 
-
 void PathWalker_NS::finalizeWalk() {
 	_engineFlags &= ~kEngineWalking;
 
@@ -371,7 +344,6 @@
 }
 
 void PathWalker_NS::updateDirection(const Common::Point& pos, const Common::Point& to) {
-
 	Common::Point dist(to.x - pos.x, to.y - pos.y);
 	WalkFrames *frames = (_a->getFrameNum() == 20) ? &_char20WalkFrames_NS : &_char24WalkFrames_NS;
 
@@ -391,11 +363,9 @@
 	_a->setF(frames->firstWalkFrame[_direction] + (_step / frames->frameRepeat[_direction]) % frames->numWalkFrames[_direction]);
 }
 
-
 PathWalker_NS::PathWalker_NS() : _direction(WALK_DOWN), _step(0) {
 }
 
-
 bool PathWalker_BR::directPathExists(const Common::Point &from, const Common::Point &to) {
 
 	Common::Point copy(from);
@@ -445,7 +415,6 @@
 	_follower._active = false;
 }
 
-
 void PathWalker_BR::buildPath(State &s, uint16 x, uint16 y) {
 	Common::Point foot;
 	s._a->getFoot(foot);
@@ -495,7 +464,6 @@
 	debugC(3, kDebugWalk, "buildPath: complex path (%i nodes)", s._walkPath.size());
 }
 
-
 void PathWalker_BR::finalizeWalk(State &s) {
 	_engineFlags &= ~kEngineWalking;
 
@@ -627,7 +595,6 @@
 	int xStep = (scale * 16) / 100 + 1;
 	int yStep = (scale * 10) / 100 + 1;
 
-
 	/* WORKAROUND: in the balloon scene, the position of the balloon (which is implemented as a 
 	Character) is controlled by the user (for movement, via this walking code) and by the scripts
 	(to simulate the balloon floating in the air, in a neverending loop that alters the position
@@ -724,12 +691,10 @@
 		s._a->getFoot(p2);
 		checkTrap(p2);
 		debugC(3, kDebugWalk, "PathWalker_BR::doWalk, stepped to (%i, %i)", p2.x, p2.y);
-		return;
+	} else {
+		debugC(3, kDebugWalk, "PathWalker_BR::doWalk, case 2");
+		finalizeWalk(s);
 	}
-
-	debugC(3, kDebugWalk, "PathWalker_BR::doWalk, case 2");
-	finalizeWalk(s);
-	return;
 }
 
 PathWalker_BR::PathWalker_BR() {
@@ -739,5 +704,4 @@
 	_follower._step = 0;
 }
 
-
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/walk.h
===================================================================
--- scummvm/trunk/engines/parallaction/walk.h	2011-01-17 23:00:52 UTC (rev 55279)
+++ scummvm/trunk/engines/parallaction/walk.h	2011-01-17 23:12:59 UTC (rev 55280)
@@ -31,12 +31,10 @@
 
 #include "parallaction/objects.h"
 
-
 namespace Parallaction {
 
 struct Character;
 
-
 class PathWalker_NS {
 	AnimationPtr _a;
 	PointList	_walkPath;
@@ -61,7 +59,6 @@
 	void walk();
 };
 
-
 class PathWalker_BR {
 
 	struct State {


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