From 4a302b25adb34e6357506a25cbfba6e182ac9209 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 10 Sep 2007 13:17:20 +0000 Subject: Lots of source code formatting corrections svn-id: r28887 --- engines/sword1/logic.cpp | 3 +- engines/sword1/router.cpp | 114 ++++++++++++++++------------------------------ 2 files changed, 39 insertions(+), 78 deletions(-) (limited to 'engines/sword1') diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index 7c15d66a46..60103ba5f9 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -317,8 +317,7 @@ int Logic::logicArAnimate(Object *compact, uint32 id) { } compact->o_walk_pc++; - if (route[compact->o_walk_pc].frame == 512) //end of sequence - { + if (route[compact->o_walk_pc].frame == 512) { //end of sequence compact->o_logic = LOGIC_script; if (((_scriptVars[GEORGE_WALKING] == 2) || (_scriptVars[GEORGE_WALKING] == 1)) && (id == PLAYER)) { diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp index 685e11fd32..6478674eb2 100644 --- a/engines/sword1/router.cpp +++ b/engines/sword1/router.cpp @@ -130,8 +130,7 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32 slowInFrames = 0; slowOutFrames = 0; - if (megaId == GEORGE) - { + if (megaId == GEORGE) { turnFramesLeft = 3 * _framesPerChar + NO_DIRECTIONS + 2 * SLOW_IN + 4 * SLOW_OUT; turnFramesRight = 3 * _framesPerChar + NO_DIRECTIONS + 2 * SLOW_IN + 4 * SLOW_OUT + NO_DIRECTIONS; walkFramesLeft = _framesPerChar + NO_DIRECTIONS; @@ -703,8 +702,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { // TURN TO START THE WALK //**************************************************************************** // rotate if we need to - if (lastDir != currentDir) - { + if (lastDir != currentDir) { // get the direction to turn turnDir = currentDir - lastDir; if ( turnDir < 0) @@ -717,10 +715,8 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { // rotate to new walk direction // for george and nico put in a head turn at the start - if ((megaId == GEORGE) || (megaId == NICO)) - { - if ( turnDir < 0) // new frames for turn frames 29oct95jps - { + if ((megaId == GEORGE) || (megaId == NICO)) { + if ( turnDir < 0) { // new frames for turn frames 29oct95jps module = turnFramesLeft + lastDir; } else { module = turnFramesRight + lastDir; @@ -734,11 +730,9 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { } // rotate till were facing new dir then go back 45 degrees - while (lastDir != currentDir) - { + while (lastDir != currentDir) { lastDir += turnDir; - if ( turnDir < 0) // new frames for turn frames 29oct95jps - { + if ( turnDir < 0) { // new frames for turn frames 29oct95jps if ( lastDir < 0) lastDir += NO_DIRECTIONS; module = turnFramesLeft + lastDir; @@ -774,8 +768,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { lastDir = 99;// this ensures that we don't put in turn frames for the start currentDir = 99;// this ensures that we don't put in turn frames for the start do { - while (_modularPath[p].num == 0) - { + while (_modularPath[p].num == 0) { p = p + 1; if (currentDir != 99) lastRealDir = currentDir; @@ -784,8 +777,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { } //calculate average amount to lose in each step on the way to the next _node currentDir = _modularPath[p].dir; - if (currentDir < NO_DIRECTIONS) - { + if (currentDir < NO_DIRECTIONS) { module = currentDir * _framesPerStep * 2 + left; if (left == 0) left = _framesPerStep; @@ -814,22 +806,18 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { errorX = errorX * stepX; errorY = _modularPath[p].y - moduleY; errorY = errorY * stepY; - if ((errorX < 0) || (errorY < 0)) - { + if ((errorX < 0) || (errorY < 0)) { _modularPath[p].num = 0; // the end of the path // okay those last steps took us past our target but do we want to scoot or moonwalk frames = stepCount - lastCount; errorX = _modularPath[p].x - walkAnim[stepCount-1].x; errorY = _modularPath[p].y - walkAnim[stepCount-1].y; - if (frames > _framesPerStep) - { + if (frames > _framesPerStep) { lastErrorX = _modularPath[p].x - walkAnim[stepCount-7].x; lastErrorY = _modularPath[p].y - walkAnim[stepCount-7].y; - if (stepX==0) - { - if (3*ABS(lastErrorY) < ABS(errorY)) //the last stop was closest - { + if (stepX==0) { + if (3*ABS(lastErrorY) < ABS(errorY)) { //the last stop was closest stepCount -= _framesPerStep; if (left == 0) left = _framesPerStep; @@ -837,8 +825,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { left = 0; } } else { - if (3*ABS(lastErrorX) < ABS(errorX)) //the last stop was closest - { + if (3*ABS(lastErrorX) < ABS(errorX)) { //the last stop was closest stepCount -= _framesPerStep; if (left == 0) left = _framesPerStep; @@ -850,8 +837,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { errorX = _modularPath[p].x - walkAnim[stepCount-1].x; errorY = _modularPath[p].y - walkAnim[stepCount-1].y; // okay we've reached the end but we still have an error - if (errorX != 0) - { + if (errorX != 0) { frameCount = 0; frames = stepCount - lastCount; do { @@ -859,8 +845,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { walkAnim[lastCount + frameCount - 1].x += errorX*frameCount/frames; } while (frameCountgetUint32(floorHeader.numBars); - if (_nBars >= O_GRID_SIZE) - { + if (_nBars >= O_GRID_SIZE) { #ifdef DEBUG //check for id > number in file, error("RouteFinder Error too many _bars %d", _nBars); #endif @@ -1925,8 +1888,7 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir) _nNodes = _resMan->getUint32(floorHeader.numNodes)+1; //array starts at 0 begins at a start _node has nnodes nodes and a target _node - if (_nNodes >= O_GRID_SIZE) - { + if (_nNodes >= O_GRID_SIZE) { #ifdef DEBUG //check for id > number in file, error("RouteFinder Error too many nodes %d", _nNodes); #endif -- cgit v1.2.3