public WalkDistancePage(WalkData walkData)
        {
            InitializeComponent();
            _walkData = walkData;
            // Update the page title for our Distance Travelled Page
            Title = "Distance Travelled Information";

            // Place a pin on the map for the chosen walk type
            MyCustomTrailMap.Pins.Add(new Pin
            {
                Type     = PinType.Place,
                Position = new Position(
                    _walkData.Latitude,
                    _walkData.Longitude),
                Label   = _walkData.Title,
                Address = "Difficulty: " + _walkData.Difficulty
                          + "Total Distance: " + _walkData.Distance,
                Id = _walkData.Title
            });

            // Create a region around the map within a one-kilometer radius
            MyCustomTrailMap.MoveToRegion(MapSpan.FromCenterAndRadius(new
                                                                      Position(_walkData.Latitude,
                                                                               _walkData.Longitude), Distance.FromKilometers(1.0)));
        }
        public WalkTrailInfoPage(WalkData walkData)
        {
            _walkData = walkData;
            InitializeComponent();

            this.BindingContext = _walkData;
        }
Ejemplo n.º 3
0
 public SwordObject(byte[] data, int offset)
 {
     Data       = data;
     Offset     = offset;
     tree       = new ScriptTree(data, offset + 108);
     bookmark   = new ScriptTree(data, offset + 152);
     talk_table = new TalkOffset[6];
     for (int i = 0; i < 6; i++)
     {
         talk_table[i] = new TalkOffset(data, offset + 232 + i * 8);
     }
     event_list = new OEventSlot[O_TOTAL_EVENTS];
     for (int i = 0; i < O_TOTAL_EVENTS; i++)
     {
         event_list[i] = new OEventSlot(data, offset + 280 + i * 8);
     }
     route = new WalkData[O_WALKANIM_SIZE];
     for (int i = 0; i < O_WALKANIM_SIZE; i++)
     {
         route[i] = new WalkData(data, offset + 340 + i * WalkData.Size);
     }
 }
Ejemplo n.º 4
0
        private int SolidWalkAnimator(WalkData[] walkAnim)
        {
            /*********************************************************************
	         * SolidWalk creates an animation based on whole steps with no sliding
	         * to get as near as possible to the target without any sliding. This
	         * routine is is intended for use when just clicking about.
	         *
	         * produce a module list from the line data
	         *
	         * returns 0 if solid route not found
	         *********************************************************************/

            int left;
            int lastDir;
            int currentDir;
            int turnDir;
            int scale;
            int step;
            int module;
            int moduleX;
            int moduleY;
            int module16X;
            int module16Y;
            int errorX;
            int errorY;
            int moduleEnd;
            int slowStart;
            int stepCount;
            int lastCount;
            int frame;

            // start at the begining for a change
            lastDir = _modularPath[0].dir;
            currentDir = _modularPath[1].dir;
            module = _framesPerChar + lastDir;
            moduleX = _startX;
            moduleY = _startY;
            module16X = moduleX << 16;
            module16Y = moduleY << 16;
            slowStart = 0;
            stepCount = 0;

            //****************************************************************************
            // SOLID
            // START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
            // BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
            //****************************************************************************
            walkAnim[stepCount].frame = module;
            walkAnim[stepCount].step = 0;
            walkAnim[stepCount].dir = lastDir;
            walkAnim[stepCount].x = moduleX;
            walkAnim[stepCount].y = moduleY;
            stepCount += 1;

            //****************************************************************************
            // SOLID
            // TURN TO START THE WALK
            //****************************************************************************
            // rotate if we need to
            if (lastDir != currentDir)
            {
                // get the direction to turn
                turnDir = currentDir - lastDir;
                if (turnDir < 0)
                    turnDir += NO_DIRECTIONS;

                if (turnDir > 4)
                    turnDir = -1;
                else if (turnDir > 0)
                    turnDir = 1;

                // rotate to new walk direction
                // for george and nico put in a head turn at the start
                if ((megaId == Logic.GEORGE) || (megaId == Logic.NICO))
                {
                    if (turnDir < 0)
                    {  // new frames for turn frames   29oct95jps
                        module = turnFramesLeft + lastDir;
                    }
                    else
                    {
                        module = turnFramesRight + lastDir;
                    }
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }

                // rotate till were facing new dir then go back 45 degrees
                while (lastDir != currentDir)
                {
                    lastDir += turnDir;
                    if (turnDir < 0)
                    {  // new frames for turn frames   29oct95jps
                        if (lastDir < 0)
                            lastDir += NO_DIRECTIONS;
                        module = turnFramesLeft + lastDir;
                    }
                    else
                    {
                        if (lastDir > 7)
                            lastDir -= NO_DIRECTIONS;
                        module = turnFramesRight + lastDir;
                    }
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
                // the back 45 degrees bit
                stepCount -= 1;// step back one because new head turn for george takes us past the new dir
            }

            //****************************************************************************
            // SOLID
            // THE SLOW IN
            //****************************************************************************

            // do start frames if its george and left or right
            if (megaId == Logic.GEORGE)
            {
                if (_modularPath[1].num > 0)
                {
                    if (currentDir == 2)
                    { // only for george
                        slowStart = 1;
                        walkAnim[stepCount].frame = 296;
                        walkAnim[stepCount].step = 0;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                        walkAnim[stepCount].frame = 297;
                        walkAnim[stepCount].step = 0;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                        walkAnim[stepCount].frame = 298;
                        walkAnim[stepCount].step = 0;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                    }
                    else if (currentDir == 6)
                    { // only for george
                        slowStart = 1;
                        walkAnim[stepCount].frame = 299;
                        walkAnim[stepCount].step = 0;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                        walkAnim[stepCount].frame = 300;
                        walkAnim[stepCount].step = 0;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                        walkAnim[stepCount].frame = 301;
                        walkAnim[stepCount].step = 0;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                    }
                }
            }
            //****************************************************************************
            // SOLID
            // THE WALK
            //****************************************************************************

            if (currentDir > 4)
                left = 1;
            else
                left = 0;

            lastCount = stepCount;
            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

            int p;

            for (p = 1; _modularPath[p].dir < NO_DIRECTIONS; ++p)
            {
                while (_modularPath[p].num > 0)
                {
                    currentDir = _modularPath[p].dir;
                    if (currentDir < NO_DIRECTIONS)
                    {

                        module = currentDir * _framesPerStep * 2 + left * _framesPerStep;
                        left = left == 0 ? 1 : 0;
                        moduleEnd = module + _framesPerStep;
                        step = 0;
                        scale = (_scaleA * moduleY + _scaleB);
                        do
                        {
                            module16X += _dx[module] * scale;
                            module16Y += _dy[module] * scale;
                            moduleX = module16X >> 16;
                            moduleY = module16Y >> 16;
                            walkAnim[stepCount].frame = module;
                            walkAnim[stepCount].step = step;
                            walkAnim[stepCount].dir = currentDir;
                            walkAnim[stepCount].x = moduleX;
                            walkAnim[stepCount].y = moduleY;
                            stepCount += 1;
                            module += 1;
                            step += 1;
                        } while (module < moduleEnd);
                        errorX = _modularPath[p].x - moduleX;
                        errorX = errorX * _modX[_modularPath[p].dir];
                        errorY = _modularPath[p].y - moduleY;
                        errorY = errorY * _modY[_modularPath[p].dir];
                        if ((errorX < 0) || (errorY < 0))
                        {
                            _modularPath[p].num = 0;
                            stepCount -= _framesPerStep;
                            left = left == 0 ? 1 : 0;
                            // Okay this is the end of a section
                            moduleX = walkAnim[stepCount - 1].x;
                            moduleY = walkAnim[stepCount - 1].y;
                            module16X = moduleX << 16;
                            module16Y = moduleY << 16;
                            _modularPath[p].x = moduleX;
                            _modularPath[p].y = moduleY;
                            // Now is the time to put in the turn frames for the last turn
                            if ((stepCount - lastCount) < _framesPerStep)
                            { // no step taken
                                currentDir = 99;// this ensures that we don't put in turn frames for this walk or the next
                                if (slowStart == 1)
                                { // clean up if a slow in but no walk
                                    stepCount -= 3;
                                    lastCount -= 3;
                                    slowStart = 0;
                                }
                            }
                            // check each turn condition in turn
                            if (((lastDir != 99) && (currentDir != 99)) && (megaId == Logic.GEORGE))
                            { // only for george
                                lastDir = currentDir - lastDir;//1 and -7 going right -1 and 7 going left
                                if (((lastDir == -1) || (lastDir == 7)) || ((lastDir == -2) || (lastDir == 6)))
                                {
                                    // turn at the end of the last walk
                                    frame = lastCount - _framesPerStep;
                                    do
                                    {
                                        walkAnim[frame].frame += 104;//turning left
                                        frame += 1;
                                    } while (frame < lastCount);
                                }
                                if (((lastDir == 1) || (lastDir == -7)) || ((lastDir == 2) || (lastDir == -6)))
                                {
                                    // turn at the end of the current walk
                                    frame = lastCount - _framesPerStep;
                                    do
                                    {
                                        walkAnim[frame].frame += 200; //was 60 now 116
                                        frame += 1;
                                    } while (frame < lastCount);
                                }
                            }
                            // all turns checked
                            lastCount = stepCount;
                        }
                    }
                }
                lastDir = currentDir;
                slowStart = 0; //can only be valid first time round
            }

            //****************************************************************************
            // SOLID
            // THE SLOW OUT
            //****************************************************************************

            if ((currentDir == 2) && (megaId == Logic.GEORGE))
            { // only for george
              // place stop frames here
              // slowdown at the end of the last walk
                frame = lastCount - _framesPerStep;
                if (walkAnim[frame].frame == 24)
                {
                    do
                    {
                        walkAnim[frame].frame += 278;//stopping right
                        frame += 1;
                    } while (frame < lastCount);
                    walkAnim[stepCount].frame = 308;
                    walkAnim[stepCount].step = 7;
                    walkAnim[stepCount].dir = currentDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
                else if (walkAnim[frame].frame == 30)
                {
                    do
                    {
                        walkAnim[frame].frame += 279;//stopping right
                        frame += 1;
                    } while (frame < lastCount);
                    walkAnim[stepCount].frame = 315;
                    walkAnim[stepCount].step = 7;
                    walkAnim[stepCount].dir = currentDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
            }
            else if ((currentDir == 6) && (megaId == Logic.GEORGE))
            { // only for george
              // place stop frames here
              // slowdown at the end of the last walk
                frame = lastCount - _framesPerStep;
                if (walkAnim[frame].frame == 72)
                {
                    do
                    {
                        walkAnim[frame].frame += 244;//stopping left
                        frame += 1;
                    } while (frame < lastCount);
                    walkAnim[stepCount].frame = 322;
                    walkAnim[stepCount].step = 7;
                    walkAnim[stepCount].dir = currentDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
                else if (walkAnim[frame].frame == 78)
                {
                    do
                    {
                        walkAnim[frame].frame += 245;//stopping left
                        frame += 1;
                    } while (frame < lastCount);
                    walkAnim[stepCount].frame = 329;
                    walkAnim[stepCount].step = 7;
                    walkAnim[stepCount].dir = currentDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
            }
            module = _framesPerChar + _modularPath[p - 1].dir;
            walkAnim[stepCount].frame = module;
            walkAnim[stepCount].step = 0;
            walkAnim[stepCount].dir = _modularPath[p - 1].dir;
            walkAnim[stepCount].x = moduleX;
            walkAnim[stepCount].y = moduleY;
            stepCount += 1;

            walkAnim[stepCount].frame = 512;
            stepCount += 1;
            walkAnim[stepCount].frame = 512;
            stepCount += 1;
            walkAnim[stepCount].frame = 512;

            //****************************************************************************
            // SOLID
            // NO END TURNS
            //****************************************************************************

            // TODO: debug(5, "routeFinder RouteSize is %d", stepCount);
            // now check the route

            for (int i = 0; i < p - 1; ++i)
            {
                if (Check(_modularPath[i].x, _modularPath[i].y, _modularPath[i + 1].x, _modularPath[i + 1].y) == 0)
                    p = 0;
            }

            if (p != 0)
            {
                _targetDir = _modularPath[p - 1].dir;
                if (CheckTarget(moduleX, moduleY) == 3)
                {
                    // new target on a line
                    p = 0;
                    // TODO: debug(5, "Solid walk target was on a line %d %d", moduleX, moduleY);
                }
            }

            return p;
        }
Ejemplo n.º 5
0
        private void SlidyWalkAnimator(WalkData[] walkAnim)
        {
            /*********************************************************************
	         * Skidding every where HardWalk creates an animation that exactly
	         * fits the smoothPath and uses foot slipping to fit whole steps into
	         * the route
	         *
	         *  Parameters: georgeg, mouseg
	         *  Returns:    rout
	         *
	         * produce a module list from the line data
	         *********************************************************************/

            int p;
            int lastDir;
            int lastRealDir;
            int currentDir;
            int turnDir;
            int scale;
            int step;
            int module;
            int moduleEnd;
            int moduleX;
            int moduleY;
            int module16X = 0;
            int module16Y = 0;
            int stepX;
            int stepY;
            int errorX;
            int errorY;
            int lastErrorX;
            int lastErrorY;
            int lastCount;
            int stepCount;
            int frameCount;
            int frames;
            int frame;

            // start at the begining for a change
            p = 0;
            lastDir = _modularPath[0].dir;
            currentDir = _modularPath[1].dir;

            if (currentDir == NO_DIRECTIONS)
                currentDir = lastDir;

            moduleX = _startX;
            moduleY = _startY;
            module16X = moduleX << 16;
            module16Y = moduleY << 16;
            stepCount = 0;

            //****************************************************************************
            // SLIDY
            // START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
            // BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
            //****************************************************************************
            module = _framesPerChar + lastDir;
            walkAnim[stepCount].frame = module;
            walkAnim[stepCount].step = 0;
            walkAnim[stepCount].dir = lastDir;
            walkAnim[stepCount].x = moduleX;
            walkAnim[stepCount].y = moduleY;
            stepCount += 1;

            //****************************************************************************
            // SLIDY
            // TURN TO START THE WALK
            //****************************************************************************
            // rotate if we need to
            if (lastDir != currentDir)
            {
                // get the direction to turn
                turnDir = currentDir - lastDir;
                if (turnDir < 0)
                    turnDir += NO_DIRECTIONS;

                if (turnDir > 4)
                    turnDir = -1;
                else if (turnDir > 0)
                    turnDir = 1;

                // rotate to new walk direction
                // for george and nico put in a head turn at the start
                if ((megaId == Logic.GEORGE) || (megaId == Logic.NICO))
                {
                    if (turnDir < 0)
                    {  // new frames for turn frames   29oct95jps
                        module = turnFramesLeft + lastDir;
                    }
                    else
                    {
                        module = turnFramesRight + lastDir;
                    }
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }

                // rotate till were facing new dir then go back 45 degrees
                while (lastDir != currentDir)
                {
                    lastDir += turnDir;
                    if (turnDir < 0)
                    {  // new frames for turn frames   29oct95jps
                        if (lastDir < 0)
                            lastDir += NO_DIRECTIONS;
                        module = turnFramesLeft + lastDir;
                    }
                    else
                    {
                        if (lastDir > 7)
                            lastDir -= NO_DIRECTIONS;
                        module = turnFramesRight + lastDir;
                    }
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
                // the back 45 degrees bit
                stepCount -= 1;// step back one because new head turn for george takes us past the new dir
            }
            // his head is in the right direction
            lastRealDir = currentDir;

            //****************************************************************************
            // SLIDY
            // THE WALK
            //****************************************************************************

            _slidyWalkAnimatorState = !_slidyWalkAnimatorState;

            lastCount = stepCount;
            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)
                {
                    p = p + 1;
                    if (currentDir != 99)
                        lastRealDir = currentDir;
                    lastDir = currentDir;
                    lastCount = stepCount;
                }
                //calculate average amount to lose in each step on the way to the next _node
                currentDir = _modularPath[p].dir;
                if (currentDir < NO_DIRECTIONS)
                {
                    module = currentDir * _framesPerStep * 2 + (_slidyWalkAnimatorState ? 1 : 0) * _framesPerStep;
                    _slidyWalkAnimatorState = !_slidyWalkAnimatorState;
                    moduleEnd = module + _framesPerStep;
                    step = 0;
                    scale = (_scaleA * moduleY + _scaleB);
                    do
                    {
                        module16X += _dx[module] * scale;
                        module16Y += _dy[module] * scale;
                        moduleX = module16X >> 16;
                        moduleY = module16Y >> 16;
                        walkAnim[stepCount].frame = module;
                        walkAnim[stepCount].step = step;
                        walkAnim[stepCount].dir = currentDir;
                        walkAnim[stepCount].x = moduleX;
                        walkAnim[stepCount].y = moduleY;
                        stepCount += 1;
                        step += 1;
                        module += 1;
                    } while (module < moduleEnd);
                    stepX = _modX[_modularPath[p].dir];
                    stepY = _modY[_modularPath[p].dir];
                    errorX = _modularPath[p].x - moduleX;
                    errorX = errorX * stepX;
                    errorY = _modularPath[p].y - moduleY;
                    errorY = errorY * stepY;
                    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)
                        {
                            lastErrorX = _modularPath[p].x - walkAnim[stepCount - 7].x;
                            lastErrorY = _modularPath[p].y - walkAnim[stepCount - 7].y;
                            if (stepX == 0)
                            {
                                if (3 * Math.Abs(lastErrorY) < Math.Abs(errorY))
                                { //the last stop was closest
                                    stepCount -= _framesPerStep;
                                    _slidyWalkAnimatorState = !_slidyWalkAnimatorState;
                                }
                            }
                            else
                            {
                                if (3 * Math.Abs(lastErrorX) < Math.Abs(errorX))
                                { //the last stop was closest
                                    stepCount -= _framesPerStep;
                                    _slidyWalkAnimatorState = !_slidyWalkAnimatorState;
                                }
                            }
                        }
                        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)
                        {
                            frameCount = 0;
                            frames = stepCount - lastCount;
                            do
                            {
                                frameCount += 1;
                                walkAnim[lastCount + frameCount - 1].x += errorX * frameCount / frames;
                            } while (frameCount < frames);
                        }
                        if (errorY != 0)
                        {
                            frameCount = 0;
                            frames = stepCount - lastCount;
                            do
                            {
                                frameCount += 1;
                                walkAnim[lastCount + frameCount - 1].y += errorY * frameCount / frames;
                            } while (frameCount < frames);
                        }
                        // Now is the time to put in the turn frames for the last turn
                        if (frames < _framesPerStep)
                            currentDir = 99;// this ensures that we don't put in turn frames for this walk or the next
                        if (currentDir != 99)
                            lastRealDir = currentDir;
                        // check each turn condition in turn
                        if (((lastDir != 99) && (currentDir != 99)) && (megaId == Logic.GEORGE))
                        { // only for george
                            lastDir = currentDir - lastDir;//1 and -7 going right -1 and 7 going left
                            if (((lastDir == -1) || (lastDir == 7)) || ((lastDir == -2) || (lastDir == 6)))
                            {
                                // turn at the end of the last walk
                                frame = lastCount - _framesPerStep;
                                do
                                {
                                    walkAnim[frame].frame += 104;//turning left
                                    frame += 1;
                                } while (frame < lastCount);
                            }
                            if (((lastDir == 1) || (lastDir == -7)) || ((lastDir == 2) || (lastDir == -6)))
                            {
                                // turn at the end of the current walk
                                frame = lastCount - _framesPerStep;
                                do
                                {
                                    walkAnim[frame].frame += 200; //was 60 now 116
                                    frame += 1;
                                } while (frame < lastCount);
                            }
                            lastDir = currentDir;
                        }
                        // all turns checked

                        lastCount = stepCount;
                        moduleX = walkAnim[stepCount - 1].x;
                        moduleY = walkAnim[stepCount - 1].y;
                        module16X = moduleX << 16;
                        module16Y = moduleY << 16;
                    }
                }
            } while (_modularPath[p].dir < NO_DIRECTIONS);



            if (lastRealDir == 99)
            {
                throw new InvalidOperationException("SlidyWalkAnimatorlast direction error");
            }
            //****************************************************************************
            // SLIDY
            // TURNS TO END THE WALK ?
            //****************************************************************************

            // We've done the walk now put in any turns at the end


            if (_targetDir == NO_DIRECTIONS)
            {  // stand in the last direction
                module = standFrames + lastRealDir;
                _targetDir = lastRealDir;
                walkAnim[stepCount].frame = module;
                walkAnim[stepCount].step = 0;
                walkAnim[stepCount].dir = lastRealDir;
                walkAnim[stepCount].x = moduleX;
                walkAnim[stepCount].y = moduleY;
                stepCount += 1;
            }
            if (_targetDir == 9)
            {
                if (stepCount == 0)
                {
                    module = _framesPerChar + lastRealDir;
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastRealDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
            }
            else if (_targetDir != lastRealDir)
            { // rotate to _targetDir
              // rotate to target direction
                turnDir = _targetDir - lastRealDir;
                if (turnDir < 0)
                    turnDir += NO_DIRECTIONS;

                if (turnDir > 4)
                    turnDir = -1;
                else if (turnDir > 0)
                    turnDir = 1;

                // rotate to target direction
                // for george and nico put in a head turn at the start
                if ((megaId == Logic.GEORGE) || (megaId == Logic.NICO))
                {
                    if (turnDir < 0)
                    {  // new frames for turn frames   29oct95jps
                        module = turnFramesLeft + lastDir;
                    }
                    else
                    {
                        module = turnFramesRight + lastDir;
                    }
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastRealDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }

                // rotate if we need to
                while (lastRealDir != _targetDir)
                {
                    lastRealDir += turnDir;
                    if (turnDir < 0)
                    {  // new frames for turn frames   29oct95jps
                        if (lastRealDir < 0)
                            lastRealDir += NO_DIRECTIONS;
                        module = turnFramesLeft + lastRealDir;
                    }
                    else
                    {
                        if (lastRealDir > 7)
                            lastRealDir -= NO_DIRECTIONS;
                        module = turnFramesRight + lastRealDir;
                    }
                    walkAnim[stepCount].frame = module;
                    walkAnim[stepCount].step = 0;
                    walkAnim[stepCount].dir = lastRealDir;
                    walkAnim[stepCount].x = moduleX;
                    walkAnim[stepCount].y = moduleY;
                    stepCount += 1;
                }
                module = standFrames + lastRealDir;
                walkAnim[stepCount - 1].frame = module;
            }
            else
            { // just stand at the end
                module = standFrames + lastRealDir;
                walkAnim[stepCount].frame = module;
                walkAnim[stepCount].step = 0;
                walkAnim[stepCount].dir = lastRealDir;
                walkAnim[stepCount].x = moduleX;
                walkAnim[stepCount].y = moduleY;
                stepCount += 1;
            }

            walkAnim[stepCount].frame = 512;
            stepCount += 1;
            walkAnim[stepCount].frame = 512;
            stepCount += 1;
            walkAnim[stepCount].frame = 512;
            //Tdebug("RouteFinder RouteSize is %d", stepCount);
            return;
        }
Ejemplo n.º 6
0
 public SwordObject(byte[] data, int offset)
 {
     Data = data;
     Offset = offset;
     tree = new ScriptTree(data, offset + 108);
     bookmark = new ScriptTree(data, offset + 152);
     talk_table = new TalkOffset[6];
     for (int i = 0; i < 6; i++)
     {
         talk_table[i] = new TalkOffset(data, offset + 232 + i * 8);
     }
     event_list = new OEventSlot[O_TOTAL_EVENTS];
     for (int i = 0; i < O_TOTAL_EVENTS; i++)
     {
         event_list[i] = new OEventSlot(data, offset + 280 + i * 8);
     }
     route = new WalkData[O_WALKANIM_SIZE];
     for (int i = 0; i < O_WALKANIM_SIZE; i++)
     {
         route[i] = new WalkData(data, offset + 340 + i * WalkData.Size);
     }
 }
 // that ends the current trail and returns back to the main screen.
 private void EndThisTrail_Clicked(object sender, EventArgs e)
 {
     _walkData = null;
     Navigation.PopToRootAsync(true);
 }