Skip to content

Commit

Permalink
Added back location-based tiles for growths.
Browse files Browse the repository at this point in the history
  • Loading branch information
RosaryMala committed Aug 30, 2014
1 parent 53159a1 commit a3678b6
Show file tree
Hide file tree
Showing 18 changed files with 441 additions and 107 deletions.
95 changes: 58 additions & 37 deletions Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ ALLEGRO_BITMAP *sprite_webing = 0;
ALLEGRO_BITMAP *sprite_boiling = 0;
ALLEGRO_BITMAP *sprite_oceanwave = 0;

enum growth_locations
{
LOCATION_NONE = -1,
LOCATION_TWIGS = 0,
LOCATION_LIGHT_BRANCHES,
LOCATION_HEAVY_BRANCHES,
LOCATION_TRUNK,
LOCATION_ROOTS,
LOCATION_CAP,
LOCATION_SAPLING,
LOCATION_SHRUB
};

int randomCube[RANDOM_CUBE][RANDOM_CUBE][RANDOM_CUBE];

void initRandomCube()
Expand Down Expand Up @@ -209,52 +222,60 @@ void Tile::DrawGrowth(c_sprite * spriteobject, bool top=true)
continue;
if (growth->timing_2 >= 0 && growth->timing_2 < time)
continue;
if ((growth->locations.bits.cap && tileMaterial() == RemoteFortressReader::MUSHROOM)
|| (growth->locations.bits.heavy_branches && (tileSpecial() == RemoteFortressReader::BRANCH && tileType != df::tiletype::TreeBranches))
|| (growth->locations.bits.light_branches && tileType == df::tiletype::TreeBranches)
|| (growth->locations.bits.roots && tileMaterial() == RemoteFortressReader::ROOT)
|| (growth->locations.bits.sapling && tileMaterial() == RemoteFortressReader::SAPLING)
|| (growth->locations.bits.trunk && tileShape() == RemoteFortressReader::WALL)
|| (growth->locations.bits.twigs && tileShape() == RemoteFortressReader::TWIG))
{
growth_locations loca = LOCATION_NONE;
if (growth->locations.bits.cap && tileMaterial() == RemoteFortressReader::MUSHROOM)
loca = LOCATION_CAP;
if (growth->locations.bits.heavy_branches && (tileSpecial() == RemoteFortressReader::BRANCH && tileType != df::tiletype::TreeBranches))
loca = LOCATION_HEAVY_BRANCHES;
if (growth->locations.bits.roots && tileMaterial() == RemoteFortressReader::ROOT)
loca = LOCATION_ROOTS;
if (growth->locations.bits.light_branches && tileType == df::tiletype::TreeBranches)
loca = LOCATION_LIGHT_BRANCHES;
if (growth->locations.bits.sapling && tileMaterial() == RemoteFortressReader::SAPLING)
loca = LOCATION_SAPLING;
if (growth->locations.bits.trunk && tileShape() == RemoteFortressReader::WALL)
loca = LOCATION_TRUNK;
if (growth->locations.bits.twigs && tileShape() == RemoteFortressReader::TWIG)
loca = LOCATION_TWIGS;

if (loca == LOCATION_NONE)
continue;

DFHack::t_matglossPair fakeMat;
fakeMat.index = tree.index;
fakeMat.type = i;
if (top)
spriteobject = contentLoader->growthTopConfigs.get(fakeMat);
else
spriteobject = contentLoader->growthBottomConfigs.get(fakeMat);
DFHack::t_matglossPair fakeMat;
fakeMat.index = tree.index;
fakeMat.type = i * 10 + loca;
if (top)
spriteobject = contentLoader->growthTopConfigs.get(fakeMat);
else
spriteobject = contentLoader->growthBottomConfigs.get(fakeMat);

if (spriteobject)
if (spriteobject)
{
DFHack::t_matglossPair growthMat;
growthMat.index = growth->mat_index;
growthMat.type = growth->mat_type;
ALLEGRO_COLOR growCol = lookupMaterialColor(growthMat);
if (growth->prints.size() > 1)
{
DFHack::t_matglossPair growthMat;
growthMat.index = growth->mat_index;
growthMat.type = growth->mat_type;
ALLEGRO_COLOR growCol = lookupMaterialColor(growthMat);
if (growth->prints.size() > 1)
df::plant_growth_print * basePrint = growth->prints[0];
df::plant_growth_print * currentPrint = basePrint;
for (int k = 0; k < growth->prints.size(); k++)
{
df::plant_growth_print * basePrint = growth->prints[0];
df::plant_growth_print * currentPrint = basePrint;
for (int k = 0; k < growth->prints.size(); k++)
{
if (growth->prints[k]->timing_start >= 0 && growth->prints[k]->timing_start > time)
continue;
if (growth->prints[k]->timing_end >= 0 && growth->prints[k]->timing_end < time)
continue;
currentPrint = growth->prints[k];
}
growCol = morph_color(growCol,
ssConfig.colors.getDfColor(basePrint->color[0], basePrint->color[2], ssConfig.useDfColors),
ssConfig.colors.getDfColor(currentPrint->color[0], currentPrint->color[2], ssConfig.useDfColors));
if (growth->prints[k]->timing_start >= 0 && growth->prints[k]->timing_start > time)
continue;
if (growth->prints[k]->timing_end >= 0 && growth->prints[k]->timing_end < time)
continue;
currentPrint = growth->prints[k];
}
spriteobject->set_growthColor(growCol);
spriteobject->assemble_world(x, y, z, this);
growCol = morph_color(growCol,
ssConfig.colors.getDfColor(basePrint->color[0], basePrint->color[2], ssConfig.useDfColors),
ssConfig.colors.getDfColor(currentPrint->color[0], currentPrint->color[2], ssConfig.useDfColors));
}
spriteobject->set_growthColor(growCol);
spriteobject->assemble_world(x, y, z, this);
}
}
}

}

void Tile::AssembleTile( void )
Expand Down
10 changes: 5 additions & 5 deletions resources/growths/apple_trees_foliage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ None as of now.
<growths file="apple_foliage_px_grey.png">

<growth sheetIndex="19" outline="0" layer="top">
<part token="APPLE:LEAVES" />
<part token="PEAR:LEAVES" />
<part token="SAND_PEAR:LEAVES" />
<part token="APPLE:LEAVES:*" />
<part token="PEAR:LEAVES:*" />
<part token="SAND_PEAR:LEAVES:*" />
<subsprite file="tree_shadow.png" sheetIndex="0" offsety="16" />
<subsprite file="tree_shadow.png" sheetIndex="0" offsety="12" />
<subsprite file="tree_shadow.png" sheetIndex="0" offsety="8" />
Expand All @@ -34,11 +34,11 @@ None as of now.
</growth>

<growth sheetIndex="50" file="apple_foliage_px_grey.png" variations="2" offsety="4" layer="bottom" >
<part token="APPLE:FRUIT" />
<part token="APPLE:FRUIT:*" />
</growth>

<growth sheetIndex="40" file="apple_foliage_px_grey.png" variations="4" layer="top" >
<part token="APPLE:FLOWERS" />
<part token="APPLE:FLOWERS:*" />
</growth>


Expand Down
58 changes: 19 additions & 39 deletions resources/growths/base_trees_foliage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ None as of now.
<growths file="base_foliage_grey.png">

<growth sheetIndex="19" outline="0" color="material" layer="top">
<part token="*:LEAVES" />
<part token="*:LEAVES:*" />
<subsprite file="tree_shadow.png" sheetIndex="0" offsety="16" />
<subsprite file="tree_shadow.png" sheetIndex="0" offsety="12" />
<subsprite file="tree_shadow.png" sheetIndex="0" offsety="8" />
Expand All @@ -25,48 +25,28 @@ None as of now.

</growth>

<growth sheetIndex="12" variations="2" file="base_foliage.png" outline="0">
<terrain token="TreeBranchesSmooth" />
<terrain token="TreeDeadBranchesSmooth" />

<subsprite sheetIndex="14" border_floor_NOR="8" border_wall_NOR="8" border_ramp_NOR="8"/>
<subsprite sheetIndex="15" border_floor_NOR="2" border_wall_NOR="2" border_ramp_NOR="2"/>
<subsprite sheetIndex="16" border_floor_NOR="4" border_wall_NOR="4" border_ramp_NOR="4"/>
<subsprite sheetIndex="17" border_floor_NOR="6" border_wall_NOR="6" border_ramp_NOR="6"/>
</growth>

<growth sheetIndex="19" outline="0" color="material">
<terrain token="TreeTwigs" />
<terrain token="TreeDeadTwigs" />
<part token="*:LEAVES:TWIGS" />

<subsprite file="tree_shadow.png" sheetIndex="1" offsety="16" />
<subsprite file="tree_shadow.png" sheetIndex="1" offsety="12" />
<subsprite file="tree_shadow.png" sheetIndex="1" offsety="8" />
<subsprite file="tree_shadow.png" sheetIndex="1" offsety="4" />
<subsprite file="tree_shadow.png" color="growth" sheetIndex="1" offsety="16" />
<subsprite file="tree_shadow.png" color="growth" sheetIndex="1" offsety="12" />
<subsprite file="tree_shadow.png" color="growth" sheetIndex="1" offsety="8" />
<subsprite file="tree_shadow.png" color="growth" sheetIndex="1" offsety="4" />

<!--fruit
<subsprite sheetIndex="50" file="base_foliage.png" variations="2" offsety="4"/>
-->
<!-- leaves -->
<subsprite sheetIndex="20" file="base_foliage_grey.png" color="growth" variations="2"/>
<subsprite sheetIndex="22" file="base_foliage_grey.png" color="growth" border_floor_NOR="8" border_wall_NOR="8" border_ramp_NOR="8"/>
<subsprite sheetIndex="23" file="base_foliage_grey.png" color="growth" border_floor_NOR="2" border_wall_NOR="2" border_ramp_NOR="2"/>
<subsprite sheetIndex="24" file="base_foliage_grey.png" color="growth" border_floor_NOR="4" border_wall_NOR="4" border_ramp_NOR="4"/>
<subsprite sheetIndex="25" file="base_foliage_grey.png" color="growth" border_floor_NOR="6" border_wall_NOR="6" border_ramp_NOR="6"/>
</growth>

<subsprite sheetIndex="0" variations="2" color="material" />
<subsprite sheetIndex="2" border_floor_NOR="8" border_wall_NOR="8" border_ramp_NOR="8" color="material"/>
<subsprite sheetIndex="3" border_floor_NOR="2" border_wall_NOR="2" border_ramp_NOR="2" color="material"/>
<subsprite sheetIndex="4" border_floor_NOR="4" border_wall_NOR="4" border_ramp_NOR="4" color="material"/>
<subsprite sheetIndex="5" border_floor_NOR="6" border_wall_NOR="6" border_ramp_NOR="6" color="material"/>
<growth sheetIndex="70" file="base_foliage_grey.png" color="growth" variations="2" offsety="4" layer="bottom" >
<part token="*:FRUIT:*" />
</growth>

<!-- leaves -->
<subsprite sheetIndex="20" file="base_foliage.png" variations="2"/>
<subsprite sheetIndex="22" file="base_foliage.png" border_floor_NOR="8" border_wall_NOR="8" border_ramp_NOR="8"/>
<subsprite sheetIndex="23" file="base_foliage.png" border_floor_NOR="2" border_wall_NOR="2" border_ramp_NOR="2"/>
<subsprite sheetIndex="24" file="base_foliage.png" border_floor_NOR="4" border_wall_NOR="4" border_ramp_NOR="4"/>
<subsprite sheetIndex="25" file="base_foliage.png" border_floor_NOR="6" border_wall_NOR="6" border_ramp_NOR="6"/>
<!--snow-->
<subsprite snow_min="10" sheetIndex="70" file="base_foliage.png" variations="2"/>
<!--flowers
<subsprite sheetIndex="60" variations="2" file="base_foliage.png"/>
<subsprite sheetIndex="62" file="base_foliage.png" border_floor_NOR="8" border_wall_NOR="8" border_ramp_NOR="8" variations="2" />
<subsprite sheetIndex="64" file="base_foliage.png" border_floor_NOR="2" border_wall_NOR="2" border_ramp_NOR="2" variations="2" />
<subsprite sheetIndex="68" file="base_foliage.png" border_floor_NOR="4" border_wall_NOR="4" border_ramp_NOR="4" variations="2" />
<subsprite sheetIndex="70" file="base_foliage.png" border_floor_NOR="6" border_wall_NOR="6" border_ramp_NOR="6" variations="2" />-->
<growth sheetIndex="60" file="base_foliage_grey.png" color="growth" variations="4" layer="top" >
<part token="*:FLOWERS:*" />
</growth>

</growths>
38 changes: 38 additions & 0 deletions resources/growths/fruits_citrus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<growths file="fruits_citrus_px.png">

<growth sheetIndex="0" variations="2" offsety="4" layer="bottom" >
<part token="LIME:FRUIT:*" />
</growth>

<growth sheetIndex="20" variations="2" offsety="4" layer="bottom" >
<part token="POMELO:FRUIT:*" />
</growth>

<growth sheetIndex="40" variations="2" offsety="4" layer="bottom" >
<part token="CITRON:FRUIT:*" />
</growth>

<growth sheetIndex="60" variations="2" offsety="4" layer="bottom" >
<part token="ORANGE:FRUIT:*" />
</growth>

<growth sheetIndex="80" variations="2" offsety="4" layer="bottom" >
<part token="BITTER_ORANGE:FRUIT:*" />
</growth>

<growth sheetIndex="100" variations="2" offsety="4" layer="bottom" >
<part token="FINGER_LIME:FRUIT:*" />
</growth>

<growth sheetIndex="120" variations="2" offsety="4" layer="bottom" >
<part token="ROUND_LIME:FRUIT:*" />
</growth>

<growth sheetIndex="140" variations="2" offsety="4" layer="bottom" >
<part token="DESSERT_LIME:FRUIT:*" />
</growth>

<growth sheetIndex="160" variations="2" offsety="4" layer="bottom" >
<part token="KUMQUAT:FRUIT:*" />
</growth>
</growths>
Binary file added resources/growths/fruits_citrus_px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions resources/growths/fruits_mediterranean.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<growths file="fruits_mediterranean_px.png">

<growth sheetIndex="5" variations="2" offsety="4" layer="bottom" >
<part token="CUSTARD_APPLE:FRUIT:*" />
</growth>

<growth sheetIndex="25" variations="2" offsety="4" layer="bottom" >
<part token="DATE_PALM:FRUIT:*" />
</growth>

<growth sheetIndex="45" variations="2" offsety="4" layer="bottom" >
<part token="LYCHEE:FRUIT:*" />
</growth>

<growth sheetIndex="65" variations="2" offsety="4" layer="top" >
<part token="MACADAMIA:FRUIT:*" />
</growth>

<growth sheetIndex="85" variations="2" offsety="4" layer="bottom" >
<part token="OLIVE:FRUIT:*" />
</growth>

<growth sheetIndex="105" variations="2" offsety="4" layer="bottom" >
<part token="POMEGRENATE:FRUIT:*" />
</growth>

</growths>
Binary file added resources/growths/fruits_mediterranean_px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a3678b6

Please sign in to comment.