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]; }
/// <summary> /// Gets a tile reference from the given coordinate /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public TileReference GetTileReference(int x, int y) { // we check to see if our override map has something on top of it if (overrideMap[x][y] != 0) { return(tileReferences.GetTileReference(overrideMap[x][y])); } if (IsLargeMap) { return(tileReferences.GetTileReference(CurrentLargeMap.TheMap[x][y])); } else { return(tileReferences.GetTileReference(CurrentSmallMap.TheMap[x][y])); } }
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; }
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; }
protected void InitializeAStarMap(TileReferences spriteTileReferences) { Debug.Assert(TheMap != null); Debug.Assert(TheMap.Length > 0); int nXTiles = TheMap[0].Length; int nYTiles = TheMap.Length; // load the A-Star compatible map into memory aStarNodes = Utils.Init2DList <AStarSharp.Node>(nXTiles, nYTiles); for (int x = 0; x < nXTiles; x++) { for (int y = 0; y < nYTiles; y++) { TileReference currentTile = spriteTileReferences.GetTileReference(TheMap[x][y]); bool bIsWalkable = currentTile.IsWalking_Passable || currentTile.Index == 184 || currentTile.Index == 186; AStarSharp.Node node = new AStarSharp.Node(new System.Numerics.Vector2(x, y), bIsWalkable); aStarNodes[x].Add(node); } } astar = new AStarSharp.Astar(aStarNodes); }