mirror of https://github.com/skeeto/pixelcity.git
Added more variety to tower-type buildings. Prevented the "steps" look those buildings were sometimes prone to have.
This commit is contained in:
parent
11fa52a08c
commit
8466a7bc88
19
Building.cpp
19
Building.cpp
|
@ -772,27 +772,28 @@ void CBuilding::CreateTower ()
|
||||||
int tier_fraction;
|
int tier_fraction;
|
||||||
int grouping;
|
int grouping;
|
||||||
int foundation;
|
int foundation;
|
||||||
|
int narrowing_interval;
|
||||||
|
int tiers;
|
||||||
float ledge;
|
float ledge;
|
||||||
float uv_start;
|
float uv_start;
|
||||||
bool blank_corners;
|
bool blank_corners;
|
||||||
bool roof_spike;
|
bool roof_spike;
|
||||||
bool narrowing;
|
|
||||||
bool tower;
|
bool tower;
|
||||||
|
|
||||||
//How much ledges protrude from the building
|
//How much ledges protrude from the building
|
||||||
ledge = (float)RandomVal (3) * 0.25f;
|
ledge = (float)RandomVal (3) * 0.25f;
|
||||||
//How tall the ledges are, in stories
|
//How tall the ledges are, in stories
|
||||||
ledge_height = RandomVal (3) + 1;
|
ledge_height = RandomVal (4) + 1;
|
||||||
//How the windows are grouped
|
//How the windows are grouped
|
||||||
grouping = RandomVal (3) + 2;
|
grouping = RandomVal (3) + 2;
|
||||||
//if the corners of the building have no windows
|
//if the corners of the building have no windows
|
||||||
blank_corners = COIN_FLIP;
|
blank_corners = RandomVal (4) > 0;
|
||||||
//if the roof is pointed or has infrastructure on it
|
//if the roof is pointed or has infrastructure on it
|
||||||
roof_spike = RandomVal (3) == 0;
|
roof_spike = RandomVal (3) == 0;
|
||||||
//What fraction of the remaining height should be given to each tier
|
//What fraction of the remaining height should be given to each tier
|
||||||
tier_fraction = 2 + RandomVal (3);
|
tier_fraction = 2 + RandomVal (4);
|
||||||
//Does the tower get narrower towards the top?
|
//How often (in tiers) does the building get narrorwer?
|
||||||
narrowing = RandomVal (3) == 0;
|
narrowing_interval = 1 + RandomVal (10);
|
||||||
//The height of the windowsless slab at the bottom
|
//The height of the windowsless slab at the bottom
|
||||||
foundation = 2 + RandomVal (3);
|
foundation = 2 + RandomVal (3);
|
||||||
//The odds that we'll have a big fancy spikey top
|
//The odds that we'll have a big fancy spikey top
|
||||||
|
@ -803,6 +804,7 @@ void CBuilding::CreateTower ()
|
||||||
front = _y;
|
front = _y;
|
||||||
back = _y + _depth;
|
back = _y + _depth;
|
||||||
bottom = 0;
|
bottom = 0;
|
||||||
|
tiers = 0;
|
||||||
//build the foundations.
|
//build the foundations.
|
||||||
ConstructCube ((float)left - ledge, (float)right + ledge, (float)front - ledge, (float)back + ledge, (float)bottom, (float)foundation);
|
ConstructCube ((float)left - ledge, (float)right + ledge, (float)front - ledge, (float)back + ledge, (float)bottom, (float)foundation);
|
||||||
bottom += foundation;
|
bottom += foundation;
|
||||||
|
@ -828,9 +830,8 @@ void CBuilding::CreateTower ()
|
||||||
bottom += ledge_height;
|
bottom += ledge_height;
|
||||||
if (bottom > _height)
|
if (bottom > _height)
|
||||||
break;
|
break;
|
||||||
if (ledge_height > 1 && narrowing)
|
tiers++;
|
||||||
ledge_height--;
|
if ((tiers % narrowing_interval) == 0) {
|
||||||
if (narrowing) {
|
|
||||||
if (section_width > 7) {
|
if (section_width > 7) {
|
||||||
left+=1;
|
left+=1;
|
||||||
right-=1;
|
right-=1;
|
||||||
|
|
Loading…
Reference in New Issue