diff options
| author | Japa | 2010-05-12 10:29:52 +0000 |
|---|---|---|
| committer | Japa | 2010-05-12 10:29:52 +0000 |
| commit | c519d1f44bf676fa4bc45323348555309183f253 (patch) | |
| tree | d56dad7d09dadffd2cf9fd187dc77328c6f0de27 /CreatureConfiguration.cpp | |
| parent | 3de822060d8453814df4684a80b38b3a441b4742 (diff) | |
| download | stonesense-c519d1f44bf676fa4bc45323348555309183f253.tar.gz stonesense-c519d1f44bf676fa4bc45323348555309183f253.tar.bz2 stonesense-c519d1f44bf676fa4bc45323348555309183f253.tar.xz | |
added the ability to color creatures according to bodyparts. coming soon: coloring only part of a creature
Diffstat (limited to 'CreatureConfiguration.cpp')
| -rw-r--r-- | CreatureConfiguration.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/CreatureConfiguration.cpp b/CreatureConfiguration.cpp index c553ff9..5506fd9 100644 --- a/CreatureConfiguration.cpp +++ b/CreatureConfiguration.cpp @@ -172,6 +172,28 @@ bool addSingleCreatureConfig( TiXmlElement* elemCreature, vector<vector<Creature if (shadow < 0 || shadow > MAX_SHADOW)
shadow = baseShadow;
+ //decide what the sprite should be shaded by.
+ const char* spriteVarColorStr = elemVariant->Attribute("color");
+ if (spriteVarColorStr == NULL || spriteVarColorStr[0] == 0)
+ {
+ sprite.shadeBy = ShadeNone;
+ }
+ else
+ {
+ sprite.shadeBy = getShadeType(spriteVarColorStr);
+ }
+
+ //do bodyparts
+ const char* bodyVarPartStr = elemVariant->Attribute("bodypart");
+ if (bodyVarPartStr == NULL || bodyVarPartStr[0] == 0)
+ {
+ for(int i = 0; i < 128; i++)sprite.bodyPart[i] = 0;
+ }
+ else
+ {
+ strcpy(sprite.bodyPart, bodyVarPartStr);
+ }
+
//create profession config
sprite.sheetIndex=atoi(sheetIndexStr);
CreatureConfiguration cre( professionID, customStr , cresex, crespec, sprite, shadow);
@@ -184,6 +206,25 @@ bool addSingleCreatureConfig( TiXmlElement* elemCreature, vector<vector<Creature baseShadow;
sheetIndexStr = elemCreature->Attribute("sheetIndex");
sprite.animFrames = ALL_FRAMES;
+ const char* spriteColorStr = elemCreature->Attribute("color");
+ if (spriteColorStr == NULL || spriteColorStr[0] == 0)
+ {
+ sprite.shadeBy = ShadeNone;
+ }
+ else
+ {
+ sprite.shadeBy = getShadeType(spriteColorStr);
+ }
+ //do bodyparts
+ const char* bodyPartStr = elemCreature->Attribute("bodypart");
+ if (bodyPartStr == NULL || bodyPartStr[0] == 0)
+ {
+ for(int i = 0; i < 128; i++)sprite.bodyPart[i] = 0;
+ }
+ else
+ {
+ strcpy(sprite.bodyPart, bodyPartStr);
+ }
if (sheetIndexStr)
{
sprite.sheetIndex = atoi( sheetIndexStr );
|
