// 1) Gets random TileSet index for Room from LoadedTileSets // 2) Calls AddTextureName, which adds the TileSet name to this.mapEngineTextureNames // and current AreaMap.TextureNameList static public void MakeRoomArea(ref AreaMap new_map, ref AreaMapType template) { int rand_tile_set_index = 0; rand_tile_set_index = rand.Next(0, MapGenHelper.LoadedTileSets.Count()); MapGenHelper.CurrentTileSet = MapGenHelper.LoadedTileSets[rand_tile_set_index]; foreach (Point sqr in new_map.RoomList[MapGenHelper.roomCounter].AllSquares) { MapGenHelper.AddTextureName(ref new_map, ref new_map.MSGrid[sqr.Y][sqr.X], MapGenHelper.LoadedTileSets[rand_tile_set_index].TextureName); MapGenHelper.AddRoomSqrTile(ref new_map, ref new_map.MSGrid[sqr.Y][sqr.X], sqr.X, sqr.Y); } }
static public void MakeHallWalls(ref AreaMap new_map) { int x_tile_max = new_map.widthTiles; int y_tile_max = new_map.heightTiles; for (int y = 0; y < y_tile_max; y++) { for (int x = 0; x < x_tile_max; x++) { if (new_map.MSGrid[y][x].MSStates[(int)MSFlagIndex.WALL_RM_ENT] == MSFlag.PWALL) { new_map.MSGrid[y][x].MSStates[(int)MSFlagIndex.BL_ST] = MSFlag.NT_BL; new_map.MSGrid[y][x].MSStates[(int)MSFlagIndex.WALL_RM_ENT] = MSFlag.WALL; new_map.MSGrid[y][x].MSStates[(int)MSFlagIndex.PASSABLE] = MSFlag.BLKD; MapGenHelper.AddRoomSqrTile(ref new_map, ref new_map.MSGrid[y][x], x, y); } } } }
// needs a list of of vector2 for the hall path(vec_path); static public void MakeHall(ref AreaMap new_map, int curr_path, ref List <List <Point> > paths) { int new_x = 0; int new_y = 0; int prev_x = -1; int prev_y = -1; int num_sqrs = paths[curr_path].Count; for (int square = 1; square < num_sqrs - 1; square++) { prev_x = paths[curr_path][square - 1].X; prev_y = paths[curr_path][square - 1].Y; new_x = paths[curr_path][square].X; new_y = paths[curr_path][square].Y; // make new hall MapSquare new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.BL_ST] = MSFlag.NT_BL; new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.WALL_RM_ENT] = MSFlag.ROOM; new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.PASSABLE] = MSFlag.NT_BLKD; MapGenHelper.AddRoomSqrTile(ref new_map, ref new_map.MSGrid[new_y][new_x], new_x, new_y); } // turn beginning and ending MapSquares to Entrances new_x = paths[curr_path][0].X; new_y = paths[curr_path][0].Y; new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.WALL_RM_ENT] = MSFlag.ENT; new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.PASSABLE] = MSFlag.NT_BLKD; MapGenHelper.AddRoomSqrTile(ref new_map, ref new_map.MSGrid[new_y][new_x], new_x, new_y); new_x = paths[curr_path][num_sqrs - 1].X; new_y = paths[curr_path][num_sqrs - 1].Y; new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.WALL_RM_ENT] = MSFlag.ENT; new_map.MSGrid[new_y][new_x].MSStates[(int)MSFlagIndex.PASSABLE] = MSFlag.NT_BLKD; MapGenHelper.AddRoomSqrTile(ref new_map, ref new_map.MSGrid[new_y][new_x], new_x, new_y); if (Globals.DrawHallHeightsLinear) { MapGenHelper.SetAltitudesTest(ref new_map, curr_path, ref paths); } }