develop
Petr Mrázek 2009-09-18 11:31:56 +00:00
parent 28fb6f5703
commit 921802ce00
4 changed files with 125 additions and 35 deletions

@ -242,6 +242,33 @@ void DFHackAPI::getSize(uint32_t& x, uint32_t& y, uint32_t& z)
z = z_block_count;
}
bool DFHackAPI::ReadWoodMatgloss(vector<t_matgloss> & woods)
{
int matgloss_address = offset_descriptor->getAddress("matgloss");
// TODO: find flag for autumnal coloring?
DfVector p_matgloss = dm->readVector(matgloss_address, 4);
woods.clear();
t_matgloss mat;
// TODO: use brown?
mat.fore = 7;
mat.back = 0;
mat.bright = 0;
for (uint32_t i = 0; i< p_matgloss.getSize();i++)
{
uint32_t temp;
// read the matgloss pointer from the vector into temp
p_matgloss.read((uint32_t)i,(uint8_t *)&temp);
// read the string pointed at by
mat.id = dm->readSTLString(temp); // reads a C string given an address
woods.push_back(mat);
}
return true;
}
bool DFHackAPI::ReadStoneMatgloss(vector<t_matgloss> & stones)
{
int matgloss_address = offset_descriptor->getAddress("matgloss");
@ -295,35 +322,6 @@ bool DFHackAPI::ReadMetalMatgloss(vector<t_matgloss> & metals)
return true;
}
bool DFHackAPI::ReadWoodMatgloss(vector<t_matgloss> & woods)
{
int matgloss_address = offset_descriptor->getAddress("matgloss");
// TODO: find flag for autumnal coloring?
DfVector p_matgloss = dm->readVector(matgloss_address, 4);
woods.clear();
t_matgloss mat;
// TODO: use brown?
mat.fore = 7;
mat.back = 0;
mat.bright = 0;
for (uint32_t i = 0; i< p_matgloss.getSize();i++)
{
uint32_t temp;
// read the matgloss pointer from the vector into temp
p_matgloss.read((uint32_t)i,(uint8_t *)&temp);
// read the string pointed at by
mat.id = dm->readSTLString(temp); // reads a C string given an address
woods.push_back(mat);
}
return true;
}
bool DFHackAPI::ReadPlantMatgloss(vector<t_matgloss> & plants)
{
int matgloss_address = offset_descriptor->getAddress("matgloss");

@ -21,7 +21,6 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "DFTileTypes.h"
bool isWallTerrain(int in)
@ -305,18 +304,22 @@ bool isFloorTerrain(int in)
case 402: //stone boulder
case 403: //lavastone boulder
case 404: //featstone boulder
case 405: //stone pebbles 1
case 406: //stone pebbles 2
case 407: //stone pebbles 3
case 408: //stone pebbles 4
case 409: //lavastone pebbles 1
case 410: //lavastone pebbles 2
case 411: //lavastone pebbles 3
case 412: //lavastone pebbles 4
case 413: //featstone pebbles 1
case 414: //featstone pebbles 2
case 415: //featstone pebbles 3
case 416: //featstone pebbles 4
case 441: //minstone floor 1 (cavern raw)
case 442: //minstone floor 2 (cavern raw)
case 443: //minstone floor 3 (cavern raw)
@ -366,27 +369,37 @@ bool isStairTerrain(int in)
case 25: //up-down stair frozen liquid
case 26: //down stair frozen liquid
case 27: //up stair frozen liquid
case 36: //up-down stair lavastone
case 37: //down stair lavastone
case 38: //up stair lavastone
case 39: //up-down stair soil
case 40: //down stair soil
case 41: //up stair soil
case 49: //up-down stair grass1 [muddy?]
case 50: //down stair grass1 [muddy?]
case 51: //up stair grass1 [muddy?]
case 52: //up-down stair grass2
case 53: //down stair grass2
case 54: //up stair grass2
case 55: //up-down stair stone
case 56: //down stair stone
case 57: //up stair stone
case 58: //up-down stair minstone
case 59: //down stair minstone
case 60: //up stair minstone
case 61: //up-down stair featstone
case 62: //down stair featstone
case 63: //up stair featstone
case 515: //stair up-down constructed
case 516: //stair down constructed
case 517: //stair up constructed
@ -418,11 +431,13 @@ bool isOpenTerrain(int in)
case 40: //down stair soil
case 41: //up stair soil
case 42: //eerie pit
case 43: //stone floor detailed
case 44: //lavastone floor detailed
case 45: //featstone? floor detailed
case 46: //minstone? floor detailed [calcite]
case 47: //frozen liquid floor detailed
case 49: //up-down stair grass1 [muddy?]
case 50: //down stair grass1 [muddy?]
case 51: //up stair grass1 [muddy?]
@ -1022,3 +1037,21 @@ int picktexture(int in)
return 6;
}
int getVegetationType(int in)
{
switch(in)
{
case 391: //dead tree
return TREE_DEAD;
case 392: //dead sapling
return SAPLING_DEAD;
case 393: //dead shrub
return SHRUB_DEAD;
case 24: //tree
return TREE_OK;
case 231: //sapling
return SAPLING_OK;
case 34: //shrub
return SHRUB_OK;
}
}

@ -23,15 +23,22 @@ distribution.
*/
#ifndef TILETYPES_H_INCLUDED
#define TILETYPES_H_INCLUDED
/// TODO: turn into XML
#define TILETYPES_H_INCLUDED
enum VegetationType{
TREE_DEAD,
TREE_OK,
SAPLING_DEAD,
SAPLING_OK,
SHRUB_DEAD,
SHRUB_OK
};
bool isWallTerrain(int in);
bool isFloorTerrain(int in);
bool isRampTerrain(int in);
bool isStairTerrain(int in);
bool isOpenTerrain(int in);
int getVegetationType(int in);
int picktexture(int in);
#endif // TILETYPES_H_INCLUDED

@ -129,14 +129,66 @@ struct t_tree_desc
uint16_t z;
};
/*
case 10:
ret += "leather";
break;
case 11:
ret += "silk cloth";
break;
case 12:
ret += "plant thread cloth";
break;
case 13: // green glass
ret += "green glass";
break;
case 14: // clear glass
ret += "clear glass";
break;
case 15: // crystal glass
ret += "crystal glass";
break;
case 17:
ret += "ice";
break;
case 18:
ret += "charcoal";
break;
case 19:
ret += "potash";
break;
case 20:
ret += "ashes";
break;
case 21:
ret += "pearlash";
break;
case 24:
ret += "soap";
break;
*/
// FIXME: in order in which the raw vectors appear in df memory, move to XML
enum RawType
enum MatglossType
{
Mat_Wood,
Mat_Stone,
Mat_Plant,
Mat_Metal,
NUM_MATGLOSS_TYPES
Mat_Leather = 10,
Mat_SilkCloth = 11,
Mat_PlantCloth = 12,
Mat_GreenGlass = 13,
Mat_ClearGlass = 14,
Mat_CrystalGlass = 15,
Mat_Ice = 17,
Mat_Charcoal =18,
Mat_Potash = 20,
Mat_Ashes = 20,
Mat_PearlAsh = 21,
Mat_Soap = 24,
//NUM_MATGLOSS_TYPES
};
enum BiomeOffset