Example #1
0
        public void SetCurrentMapType(SmallMapReferences.SingleMapReference singleMapReference, LargeMap.Maps largeMap, TimeOfDay timeOfDay,
                                      PlayerCharacterRecords playerCharacterRecords, bool bLoadFromDisk)
        {
            _currentMapType = largeMap;

            // I may need make an additional save of state before wiping these MapCharacters out
            Characters.Clear();

            switch (largeMap)
            {
            case LargeMap.Maps.Small:
                LoadSmallMap(singleMapReference, timeOfDay, playerCharacterRecords, bLoadFromDisk);
                return;

            case LargeMap.Maps.Overworld:
                // we don't reload them because the over and underworld are only loaded at boot time
                break;

            case LargeMap.Maps.Underworld:
                break;
            }
            bool bIsLargeMap = largeMap != LargeMap.Maps.Small;

            if (bIsLargeMap)
            {
                for (int i = 0; i < MAX_MAP_CHARACTERS; i++)
                {
                    MapCharacterAnimationState charAnimState = CurrentAnimationState.GetCharacterState(i);

                    Characters.Add(new MapCharacter(null, charAnimState, null, null, timeOfDay, playerCharacterRecords));
                }
            }
        }
Example #2
0
            public static SingleMapReference GetLargeMapSingleInstance(LargeMap.Maps map)
            {
                if (map == LargeMap.Maps.Small)
                {
                    throw new Ultima5ReduxException("Can't ask for a small map when you need a large one");
                }

                return(new SingleMapReference(Location.Britannia_Underworld, map == LargeMap.Maps.Overworld ? 0 : -1,
                                              0, null));
            }
Example #3
0
        /// <summary>
        /// Loads a large map -either overworld or underworld
        /// </summary>
        /// <param name="map"></param>
        public void LoadLargeMap(LargeMap.Maps map)
        {
            int nFloor = map == LargeMap.Maps.Overworld ? 0 : -1;

            CurrentSingleMapReference = null;
            CurrentLargeMap           = largeMaps[map];
            overrideMap       = Utils.Init2DArray <int>(CurrentLargeMap.TheMap[0].Length, CurrentLargeMap.TheMap.Length);
            IsLargeMap        = true;
            LargeMapOverUnder = map;

            TheMapCharacters.SetCurrentMapType(null, map, timeOfDay, true);
        }
Example #4
0
        public void SetCurrentMapType(SmallMapReferences.SingleMapReference singleMapReference, LargeMap.Maps largeMap, TimeOfDay timeOfDay, bool bLoadFromDisk)
        {
            List <NonPlayerCharacterReference> npcCurrentMapRefs = null;

            currentMapType = largeMap;

            // I may need make an additional save of state before wiping these mapcharacters out
            Characters.Clear();

            switch (largeMap)
            {
            case LargeMap.Maps.Small:
                LoadSmallMap(singleMapReference, timeOfDay, bLoadFromDisk);
                return;

            case LargeMap.Maps.Overworld:
                // we don't reload them because the over and underworld are only loaded at boot time
                break;

            case LargeMap.Maps.Underworld:
                break;
            }
            bool bIsLargeMap = largeMap != LargeMap.Maps.Small;

            if (bIsLargeMap)
            {
                for (int i = 0; i < MAX_MAP_CHARACTERS; i++)
                {
                    // the animations are out of order - so we use this reference to track it down
                    NonPlayerCharacterReference npcRef = bIsLargeMap ? null : npcCurrentMapRefs[i];
                    MapCharacterState           mapCharState;

                    MapCharacterAnimationState charAnimState = null;

                    NonPlayerCharacterMovement charMovement;

                    mapCharState  = null;
                    charMovement  = null;
                    charAnimState = CurrentAnimationState.GetCharacterState(i);

                    Characters.Add(new MapCharacter(npcRef, charAnimState, mapCharState, charMovement, timeOfDay));
                }
                //Debug.Assert(charAnimState.X == mapCharState.X);
                //Debug.Assert(charAnimState.Y == mapCharState.Y);
                //Debug.Assert(charAnimState.Floor == mapCharState.Floor);
            }
        }
Example #5
0
 public bool IsMoonstoneBuried(Point2D position, LargeMap.Maps map)
 {
     return(IsMoonstoneBuried(new Point3D(position.X, position.Y, map == LargeMap.Maps.Overworld?0:0xFF)));
 }
Example #6
0
        public MoonPhaseReferences.MoonPhases GetMoonPhaseByPosition(Point2D position, LargeMap.Maps map)
        {
            if (!IsMoonstoneBuried(position, map))
            {
                throw new Ultima5ReduxException("Can't get a moonphase for a stone that ain't there at " + position);
            }
            int nPos = -1;
            //foreach (Point3D xy in _moongatePositions)
            Point3D xyzPos = new Point3D(position.X, position.Y, (int)map);

            for (int nMoonstone = 0; nMoonstone < 8; nMoonstone++)
            {
                Point3D xyz = _moongatePositions[nMoonstone];
                if (xyz.Z != (int)map)
                {
                    continue;
                }
                if (xyzPos == xyz)
                {
                    nPos = nMoonstone;
                    break;
                }
            }
            if (nPos == -1)
            {
                throw new Ultima5ReduxException("Unable to get moon phase by position");
            }
            // the actual position in the array signifies the current moon phase
            return((MoonPhaseReferences.MoonPhases)nPos);
        }