static public void AddRoomSqrTile(ref AreaMap current_map, ref MapSquare map_square, int x_loc, int y_loc) { int rand_TI = 0; int tile_count = map_square.MSTiles.Count(); int sources = 0; int anim_indices = 0; // 0: tile_sources_bg // 1: tile_sources_fg // 2: animated_indices_bg // 3: animated_indices_fg for (int i = 0; i < 4; i++) { addSqrIndices[i] = 0; } map_square.TileColor = Color.White; if (map_square.MSStates[(int)MSFlagIndex.WALL_RM_ENT] == MSFlag.ENT || map_square.MSStates[(int)MSFlagIndex.WALL_RM_ENT] == MSFlag.ROOM) { addSqrIndices[(int)MSMakeIndex.TILE_BG] = (int)TileGroup.BG_ROOM_SOURCES; addSqrIndices[(int)MSMakeIndex.TILE_FG] = (int)TileGroup.FG_ROOM_SOURCES; } else if (map_square.MSStates[(int)MSFlagIndex.WALL_RM_ENT] == MSFlag.WALL) { addSqrIndices[(int)MSMakeIndex.TILE_BG] = (int)TileGroup.BG_WALL_SOURCES; addSqrIndices[(int)MSMakeIndex.TILE_FG] = (int)TileGroup.FG_WALL_SOURCES; } addSqrIndices[(int)MSMakeIndex.ANM_BG] = addSqrIndices[(int)MSMakeIndex.TILE_BG]; addSqrIndices[(int)MSMakeIndex.ANM_FG] = addSqrIndices[(int)MSMakeIndex.TILE_FG]; for (int i = 0; i < tile_count; i++) { sources = addSqrIndices[i]; anim_indices = addSqrIndices[i + 2]; rand_TI = rand.Next(0, CurrentTileSet.TSrcs[sources].Count()); if (current_map.IsTileAnimated(CurrentTileSet.ATIndices[anim_indices], CurrentTileSet.TSrcs[sources][rand_TI])) { int a_t_index = CurrentTileSet.GetATIndex(CurrentTileSet, CurrentTileSet.TSrcs[anim_indices][rand_TI], sources); map_square.MSTiles[i] = new AnimatedTile( (int)CurrentTileSet.ATIndices[sources][a_t_index].Y, (int)CurrentTileSet.ATIndices[sources][a_t_index].Z, CurrentTileSet.TextureName, new Rectangle(CurrentTileSet.TSrcs[sources][rand_TI] * Globals.tileSize, sources * Globals.tileSize, Globals.tileSize, Globals.tileSize)); } else { map_square.MSTiles[i].TextureName = CurrentTileSet.TextureName; map_square.MSTiles[i].SourceRect = new Rectangle(CurrentTileSet.TSrcs[sources][rand_TI] * Globals.tileSize, sources * Globals.tileSize, Globals.tileSize, Globals.tileSize); } } }