commit 6e241f1f
Added hair
Changed files
| M | src/saland/Game.cpp before |
| M | src/saland/model/placeables.hpp before |
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp
index d4c1cb8..a96d0fb 100644
--- a/src/saland/Game.cpp
+++ b/src/saland/Game.cpp
@@ -191,8 +191,10 @@ static void DrawHumanEntity(SDL_Renderer* target, sago::SagoSpriteHolder* sHolde
} else {
mySprite.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY);
}
- /*const sago::SagoSprite &myHair = sHolder->GetSprite(entity->race + "_"+animation+"_hair_1_"+string(1,entity->direction));
- myHair.Draw(target, time, entity->X-offsetX, entity->Y-offsetY);*/
+ if (entity->hair.length() > 0) {
+ const sago::SagoSprite &myHair = sHolder->GetSprite(entity->race + "_"+animation+"_"+entity->hair+"_"+std::string(1,entity->direction));
+ myHair.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY);
+ }
}
static void DrawMonster(SDL_Renderer* target, sago::SagoSpriteHolder* sHolder, const Monster *entity, float time, int offsetX, int offsetY, bool drawCollision) {
diff --git a/src/saland/model/placeables.hpp b/src/saland/model/placeables.hpp
index 5e588af..3264c82 100644
--- a/src/saland/model/placeables.hpp
+++ b/src/saland/model/placeables.hpp
@@ -59,6 +59,7 @@ public:
class Human : public Creature {
public:
std::string race = "male";
+ std::string hair = "hair_1";
float castTimeRemaining = 0; //If non-zero then we are casting a spell
float castTime = 400; //Number of milliseconds it will take to complete the cast
};