Package me.daddychurchill.CityWorld.Support

Examples of me.daddychurchill.CityWorld.Support.SurroundingFloors


  @Override
  protected void generateActualBlocks(WorldGenerator generator, PlatMap platmap, RealChunk chunk, DataContext context, int platX, int platZ) {

    // check out the neighbors
    //SurroundingFloors neighborBasements = getNeighboringBasementCounts(platmap, platX, platZ);
    SurroundingFloors neighborFloors = getNeighboringFloorCounts(platmap, platX, platZ);
   
    // is rounding allowed and where are the stairs
    boolean allowRounded = rounded &&
        insetWallWE == insetWallNS &&
        insetCeilingWE == insetCeilingNS &&
        neighborFloors.isRoundable();
   
    StairWell stairLocation = getStairWellLocation(allowRounded, neighborFloors);
    if (!needStairsUp)
      stairLocation = StairWell.NONE;
   
    // work on the basement stairs first
    for (int floor = 0; floor < depth; floor++) {
      int floorAt = generator.streetLevel - basementFloorHeight * floor - 2;
     
      // stairs?
      if (needStairsDown) {
       
        // top is special... but only if there are no stairs up
        if (floor == 0 && !needStairsUp) {
          drawStairsWalls(generator, chunk, floorAt,
              basementFloorHeight, stairLocation, stairWallMaterial, true, false);
       
        // all the rest of those lovely stairs
        } else {

          // plain walls please
          drawStairsWalls(generator, chunk, floorAt, basementFloorHeight,
              stairLocation, wallMaterial, false, floor == depth - 1);

          // place the stairs and such
          drawStairs(generator, chunk, floorAt, basementFloorHeight,
              stairLocation, stairMaterial, stairPlatformMaterial);
           
          // pillars if no stairs here
          drawOtherPillars(chunk, floorAt, basementFloorHeight,
              stairLocation, wallMaterial);
        }
     
      // if no stairs then
      } else {
        drawOtherPillars(chunk, floorAt, basementFloorHeight,
            StairWell.CENTER, wallMaterial);
      }
    }
   
    // insetting the inset
    int localInsetWallWE = insetWallWE;
    int localInsetWallNS = insetWallNS;

    // now the above ground floors
    aboveFloorHeight = firstFloorHeight;
    for (int floor = 0; floor < height; floor++) {
      int floorAt = generator.streetLevel + aboveFloorHeight * floor + 2;
//      allowRounded = allowRounded && neighborFloors.isRoundable();
//      stairLocation = getStairWellLocation(allowRounded, neighborFloors);
//      if (!needStairsUp || floor == height - 1)
//        stairLocation = StairWell.NONE;
     
      // breath in?
      if (insetInsetted) {
        if (floor == insetInsetMidAt || floor == insetInsetHighAt) {
          localInsetWallWE++;
          localInsetWallNS++;
        }
      }
     
      // inside walls
      drawInteriorParts(generator, chunk, context,
          roomProviderForFloor(generator, chunk, floor, floorAt), floor, floorAt,
          aboveFloorHeight - 1, localInsetWallNS, localInsetWallWE,
          allowRounded, wallMaterial, glassMaterial,
          stairLocation, stairMaterial, stairWallMaterial, stairPlatformMaterial,
          needStairsUp && (floor > 0 || (floor == 0 && (depth > 0 || height > 1))),
          needStairsUp && (floor < height - 1),
          floor == height - 1, floor == 0 && depth == 0,
          neighborFloors);
       
//      // stairs?
//      if (needStairsUp) {
//       
//        // fancy walls... maybe
//        if (floor > 0 || (floor == 0 && (depth > 0 || height > 1))) {
//          drawStairsWalls(chunk, floorAt, aboveFloorHeight, stairLocation,
//              stairWallMaterial, floor == height - 1, floor == 0 && depth == 0);
//        }
//       
//        // more stairs and such
//        if (floor < height - 1)
//          drawStairs(chunk, floorAt, aboveFloorHeight, stairLocation,
//              stairMaterial, stairPlatformMaterial);
//      }
     
      // one down, more to go
      neighborFloors.decrement();
      aboveFloorHeight = otherFloorHeight;
    }
   
    // happy place?
    if (!generator.settings.includeDecayedBuildings) {
View Full Code Here


  @Override
  protected void generateActualChunk(WorldGenerator generator, PlatMap platmap, ByteChunk chunk, BiomeGrid biomes, DataContext context, int platX, int platZ) {

    // check out the neighbors
    SurroundingFloors neighborBasements = getNeighboringBasementCounts(platmap, platX, platZ);
    SurroundingFloors neighborFloors = getNeighboringFloorCounts(platmap, platX, platZ);

    // starting with the bottom
    int lowestY = getBottomY(generator);
   
    // bottom most floor
    drawCeilings(generator, chunk, context, lowestY, 1, 0, 0, false, ceilingMaterial, neighborBasements);
   
    // below ground
    for (int floor = 0; floor < depth; floor++) {
      int floorAt = generator.streetLevel - FloorHeight * floor - 2;
     
      // clear it out
      chunk.setLayer(floorAt, FloorHeight, getAirMaterial(generator, FloorHeight));
     
      // at the first floor add a fence to prevent folks from falling in
      if (floor == 0)
        drawFence(generator, chunk, context, 0, generator.streetLevel + 1, neighborBasements);
     
      // one floor please
      drawExteriorParts(generator, chunk, context, floorAt, FloorHeight, 0, 0,
          false, dirtMaterial, dirtMaterial, neighborBasements);
      drawExteriorParts(generator, chunk, context, floorAt, FloorHeight, 1, 1,
          false, wallMaterial, wallMaterial, neighborBasements);
     
      // ceilings if needed
      if (!unfinishedBasementOnly) {
        drawCeilings(generator, chunk, context, floorAt + FloorHeight - 1, 1, 1, 1,
            false, ceilingMaterial, neighborBasements);
      } else {
        drawHorizontalGirders(chunk, floorAt + FloorHeight - 1, neighborBasements);
      }
 
      // hold up the bit we just drew
      drawVerticalGirders(chunk, floorAt, FloorHeight);
     
      // one down, more to go
      neighborBasements.decrement();
    }
   
    // do more?
    if (!unfinishedBasementOnly) {
      lastHorizontalGirder = 0;

      // above ground
      for (int floor = 0; floor < height; floor++) {
        int floorAt = generator.streetLevel + FloorHeight * floor + 2;
       
        // floor built yet?
        if (floor <= floorsBuilt) {
         
          // the floor of the next floor
          drawCeilings(generator, chunk, context, floorAt + FloorHeight - 1, 1, 1, 1,
              false, ceilingMaterial, neighborFloors);
        } else {
         
          // sometimes the top most girders aren't there quite yet
          if (floor < height - 1 || chunkOdds.flipCoin()) {
            drawHorizontalGirders(chunk, floorAt + FloorHeight - 1, neighborFloors);
            lastHorizontalGirder = floorAt + FloorHeight - 1;
          }
        }
 
        // hold up the bit we just drew
        drawVerticalGirders(chunk, floorAt, FloorHeight);
       
        // one down, more to go
        neighborFloors.decrement();
      }
    }
  }
View Full Code Here

  @Override
  public PlatLot validateLot(PlatMap platmap, int platX, int platZ) {
   
    // get connected lots
    SurroundingFloors neighborFloors = getNeighboringFloorCounts(platmap, platX, platZ);
   
    if (!neighborFloors.adjacentNeighbors() && height > 1) {
     
      // make sure we don't have needle buildings
      //platmap.generator.reportMessage("Found a skinny tall building");
      return new ConcreteLot(platmap, platmap.originX + platX, platmap.originZ + platZ);
     
    // if nothing to north/south or west/east then no insets for us
    } else if ((!neighborFloors.toNorth() && !neighborFloors.toSouth()) ||
           (!neighborFloors.toWest() && !neighborFloors.toEast())) {

      // clear insets
//      insetInsetted = false;
    }
   
View Full Code Here

 
  @Override
  protected void generateActualChunk(WorldGenerator generator, PlatMap platmap, ByteChunk chunk, BiomeGrid biomes, DataContext context, int platX, int platZ) {

    // check out the neighbors
    SurroundingFloors neighborBasements = getNeighboringBasementCounts(platmap, platX, platZ);
    SurroundingFloors neighborFloors = getNeighboringFloorCounts(platmap, platX, platZ);

    // is rounding allowed?
    boolean allowRounded = rounded &&
                 insetWallWE == insetWallNS &&
                 insetCeilingWE == insetCeilingNS &&
                 neighborFloors.isRoundable();
   
    // starting with the bottom
    int lowestY = getBottomY(generator);
   
    // bottom most floor
    drawCeilings(generator, chunk, context, lowestY, 1, 0, 0, false, ceilingMaterial, neighborBasements);
    //chunk.setBlocks(0, chunk.width, lowestY, lowestY + 1, 0, chunk.width, (byte) ceilingMaterial.getId());
   
    // below ground
    if (depth > 0) {
      for (int floor = 0; floor < depth; floor++) {
        int floorAt = generator.streetLevel - basementFloorHeight * floor - 2;
 
        // clear it out
        chunk.setLayer(floorAt, basementFloorHeight, getAirMaterial(generator, floorAt));
 
        // one floor please
        drawExteriorParts(generator, chunk, context, floorAt, basementFloorHeight - 1, 0, 0,
            false, wallMaterial, wallMaterial, neighborBasements);
        drawCeilings(generator, chunk, context, floorAt + basementFloorHeight - 1, 1, 0, 0,
            false, ceilingMaterial, neighborBasements);
       
        // one down, more to go
        neighborBasements.decrement();
      }
    } else {
      chunk.setLayer(lowestY + 1, BlackMagic.getMaterialId(ceilingMaterial));
    }

    // insetting the inset
    int localInsetWallWE = insetWallWE;
    int localInsetWallNS = insetWallNS;
    int localInsetCeilingWE = insetCeilingWE;
    int localInsetCeilingNS = insetCeilingNS;

    // above ground
    aboveFloorHeight = firstFloorHeight;
    for (int floor = 0; floor < height; floor++) {
      int floorAt = generator.streetLevel + aboveFloorHeight * floor + 2;
      allowRounded = allowRounded && neighborFloors.isRoundable();

      // breath in?
      if (insetInsetted) {
        if (floor == insetInsetMidAt || floor == insetInsetHighAt) {
          localInsetWallWE++;
          localInsetWallNS++;
          localInsetCeilingWE++;
          localInsetCeilingNS++;
        }
      }
     
      // one floor please
      drawExteriorParts(generator, chunk, context, floorAt,
          aboveFloorHeight - 1, localInsetWallNS, 
          localInsetWallWE, allowRounded, wallMaterial,
          glassMaterial, neighborFloors);
      drawCeilings(generator, chunk, context, floorAt + aboveFloorHeight - 1,
          1, localInsetCeilingNS,
          localInsetCeilingWE, allowRounded, ceilingMaterial, neighborFloors);
     
      // final floor is done... how about a roof then?
      if (floor == height - 1)
        drawRoof(generator, chunk, context, generator.streetLevel + aboveFloorHeight * (floor + 1) + 2, localInsetWallNS, localInsetWallWE, allowRounded, roofMaterial, neighborFloors);

      // one down, more to go
      neighborFloors.decrement();
      aboveFloorHeight = otherFloorHeight;
    }
  }
View Full Code Here

    }
    return result;
  }
 
  protected SurroundingFloors getNeighboringFloorCounts(PlatMap platmap, int platX, int platZ) {
    SurroundingFloors neighborBuildings = new SurroundingFloors();
   
    // get a list of qualified neighbors
    PlatLot[][] neighborChunks = getNeighborPlatLots(platmap, platX, platZ, true);
    for (int x = 0; x < 3; x++) {
      for (int z = 0; z < 3; z++) {
        if (neighborChunks[x][z] == null) {
          neighborBuildings.floors[x][z] = 0;
        } else {
         
          // in order for this building to be connected to our building they would have to be the same type
          neighborBuildings.floors[x][z] = ((BuildingLot) neighborChunks[x][z]).height;
        }
      }
    }
    neighborBuildings.update();
   
    return neighborBuildings;
  }
View Full Code Here

   
    return neighborBuildings;
  }
 
  protected SurroundingFloors getNeighboringBasementCounts(PlatMap platmap, int platX, int platZ) {
    SurroundingFloors neighborBuildings = new SurroundingFloors();
   
    // get a list of qualified neighbors
    PlatLot[][] neighborChunks = getNeighborPlatLots(platmap, platX, platZ, true);
    for (int x = 0; x < 3; x++) {
      for (int z = 0; z < 3; z++) {
        if (neighborChunks[x][z] == null) {
          neighborBuildings.floors[x][z] = 0;
        } else {
         
          // in order for this building to be connected to our building they would have to be the same type
          neighborBuildings.floors[x][z] = ((BuildingLot) neighborChunks[x][z]).depth;
        }
      }
    }
    neighborBuildings.update();
   
    return neighborBuildings;
  }
View Full Code Here

TOP

Related Classes of me.daddychurchill.CityWorld.Support.SurroundingFloors

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.