Example #1
0
 /// <summary>
 /// Build the character state based on existing conditions
 /// This is called when entering a new map within the game - as opposed to loading from disk
 /// </summary>
 /// <param name="tileReferences"></param>
 /// <param name="npcRef"></param>
 /// <param name="nCharacterAnimationStateIndex"></param>
 /// <param name="timeOfDay"></param>
 public MapCharacterState(TileReferences tileReferences, NonPlayerCharacterReference npcRef, int nCharacterAnimationStateIndex, TimeOfDay timeOfDay)
 {
     NPCIndex = npcRef.DialogIndex;
     TileRef  = tileReferences.GetTileReference(npcRef.NPCKeySprite);
     CharacterAnimationStateIndex = nCharacterAnimationStateIndex;
     // if you are adding by hand then we can assume that the character is active
     TheCharacterPosition = npcRef.Schedule.GetCharacterDefaultPositionByTime(timeOfDay);
     Active = true;
 }
Example #2
0
 /// <summary>
 /// Build the character state from data retrieved from disk
 /// </summary>
 /// <param name="tileReferences"></param>
 /// <param name="stateUInts"></param>
 /// <param name="nNPCIndex"></param>
 public MapCharacterState(TileReferences tileReferences, UInt16[] stateUInts, int nNPCIndex)
 {
     Debug.Assert(stateUInts.Length == 0x8);
     NPCIndex = nNPCIndex;
     TheCharacterPosition.X     = stateUInts[1];
     TheCharacterPosition.Y     = stateUInts[2];
     TheCharacterPosition.Floor = stateUInts[3];
     TileRef = tileReferences.GetTileReference(stateUInts[4] + 0x100);
     CharacterAnimationStateIndex = stateUInts[6];
     Active = stateUInts[7] > 0;
 }
Example #3
0
        public MapCharacterStates(DataChunk charStatesDataChunk, TileReferences tileReferences)
        {
            DataChunk dataChunk = charStatesDataChunk;

            List <UInt16> characterStateBytes = dataChunk.GetChunkAsUint16List();

            for (int nIndex = 0; nIndex < MAX_CHARACTER_STATES; nIndex++)
            {
                _characterStates.Add(new MapCharacterState(tileReferences,
                                                           characterStateBytes.GetRange(nIndex * MapCharacterAnimationState.NBYTES, MapCharacterAnimationState.NBYTES).ToArray(), nIndex));
            }
        }
Example #4
0
        public MapCharacterAnimationState(TileReferences tileReferences, byte[] stateBytes)
        {
            Debug.Assert(stateBytes.Length == 0x8);
            //
            _tile1   = stateBytes[0] + 0x100;
            _tile2   = stateBytes[1] + 0x100;
            Tile1Ref = tileReferences.GetTileReference(_tile1);
            Tile2Ref = tileReferences.GetTileReference(_tile2);

            X        = stateBytes[2];
            Y        = stateBytes[3];
            Floor    = stateBytes[4];
            Depends1 = stateBytes[5];
            Depends2 = stateBytes[6];
            Depends3 = stateBytes[7];
        }
Example #5
0
        public MapCharacters(TileReferences tileRefs, NonPlayerCharacterReferences npcRefs,
                             DataChunk animationStatesDataChunk, DataChunk overworldAnimationStatesDataChunk, DataChunk underworldAnimationStatesDataChunk, DataChunk charStatesDataChunk,
                             DataChunk nonPlayerCharacterMovementLists, DataChunk nonPlayerCharacterMovementOffsets)
        {
            this._tileRefs            = tileRefs;
            _smallMapAnimationStates  = new MapCharacterAnimationStates(animationStatesDataChunk, tileRefs);
            _overworldAnimationState  = new MapCharacterAnimationStates(overworldAnimationStatesDataChunk, tileRefs);
            _underworldAnimationState = new MapCharacterAnimationStates(underworldAnimationStatesDataChunk, tileRefs);

            _charStates  = new MapCharacterStates(charStatesDataChunk, tileRefs);
            Movements    = new NonPlayerCharacterMovements(nonPlayerCharacterMovementLists, nonPlayerCharacterMovementOffsets);
            this.NPCRefs = npcRefs;

            // we always load the over and underworld from disk immediatley, no need to reload as we will track it in memory
            // going forward
            _overworldAnimationState.Load(MapCharacterAnimationStates.MapCharacterAnimationStatesFiles.BRIT_OOL, true);
            _underworldAnimationState.Load(MapCharacterAnimationStates.MapCharacterAnimationStatesFiles.UNDER_OOL, true);
        }
Example #6
0
 public MapCharacterAnimationStates(DataChunk animationStatesDataChunk,
                                    TileReferences tileReferences)
 {
     this._tileReferences           = tileReferences;
     this._animationStatesDataChunk = animationStatesDataChunk;
 }