git repos / saland

commit 495e20e8

sago007 · 2018-09-30 13:36
495e20e8efee11218372272046eb3de3d97c0864 patch · browse files
parent e8138689bb7cc6a2959d5867baddaa2742a84931

Player is now wearing pants

Changed files

A data/sprites/male_pants.sprite
A data/textures/male_hurt.png
A data/textures/male_hurt_pants.png
A data/textures/male_pants.png
A data/textures/male_slash.png
A data/textures/male_slash_pants.png
A data/textures/male_spellcast_pants.png
M src/saland/GameDraw.cpp before
M src/saland/model/placeables.hpp before
diff --git a/data/sprites/male_pants.sprite b/data/sprites/male_pants.sprite new file mode 100644 index 0000000..8711832 --- /dev/null +++ b/data/sprites/male_pants.sprite
@@ -0,0 +1,148 @@
+{
+
+
+"male_walkcycle_pants_1_N" : {
+ "texture" : "male_pants",
+ "topx" : 64,
+ "topy" : 0,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 8,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_walkcycle_pants_1_W" : {
+ "texture" : "male_pants",
+ "topx" : 64,
+ "topy" : 64,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 8,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_walkcycle_pants_1_S" : {
+ "texture" : "male_pants",
+ "topx" : 64,
+ "topy" : 128,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 8,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_walkcycle_pants_1_E" : {
+ "texture" : "male_pants",
+ "topx" : 64,
+ "topy" : 192,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 8,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_standing_pants_1_N" : {
+ "texture" : "male_pants",
+ "topx" : 0,
+ "topy" : 0,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 1,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_standing_pants_1_W" : {
+ "texture" : "male_pants",
+ "topx" : 0,
+ "topy" : 64,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 1,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_standing_pants_1_S" : {
+ "texture" : "male_pants",
+ "topx" : 0,
+ "topy" : 128,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 1,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_standing_pants_1_E" : {
+ "texture" : "male_pants",
+ "topx" : 0,
+ "topy" : 192,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 1,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_spellcast_pants_1_N" : {
+ "texture" : "male_spellcast_pants",
+ "topx" : 0,
+ "topy" : 0,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 7,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_spellcast_pants_1_W" : {
+ "texture" : "male_spellcast_pants",
+ "topx" : 0,
+ "topy" : 64,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 7,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_spellcast_pants_1_S" : {
+ "texture" : "male_spellcast_pants",
+ "topx" : 0,
+ "topy" : 128,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 7,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+},
+
+"male_spellcast_pants_1_E" : {
+ "texture" : "male_spellcast_pants",
+ "topx" : 0,
+ "topy" : 192,
+ "height" : 64,
+ "width" : 64,
+ "number_of_frames" : 7,
+ "frame_time" : 100,
+ "originx" : 32,
+ "originy" : 50
+}
+
+}
diff --git a/data/textures/male_hurt.png b/data/textures/male_hurt.png new file mode 100644 index 0000000..c807444
Binary files /dev/null and b/data/textures/male_hurt.png differ
diff --git a/data/textures/male_hurt_pants.png b/data/textures/male_hurt_pants.png new file mode 100644 index 0000000..e409573
Binary files /dev/null and b/data/textures/male_hurt_pants.png differ
diff --git a/data/textures/male_pants.png b/data/textures/male_pants.png new file mode 100644 index 0000000..b0ad825
Binary files /dev/null and b/data/textures/male_pants.png differ
diff --git a/data/textures/male_slash.png b/data/textures/male_slash.png new file mode 100644 index 0000000..0cf3330
Binary files /dev/null and b/data/textures/male_slash.png differ
diff --git a/data/textures/male_slash_pants.png b/data/textures/male_slash_pants.png new file mode 100644 index 0000000..a8c306b
Binary files /dev/null and b/data/textures/male_slash_pants.png differ
diff --git a/data/textures/male_spellcast_pants.png b/data/textures/male_spellcast_pants.png new file mode 100644 index 0000000..35e7624
Binary files /dev/null and b/data/textures/male_spellcast_pants.png differ
diff --git a/src/saland/GameDraw.cpp b/src/saland/GameDraw.cpp index 9c7438a..8ebb39e 100644 --- a/src/saland/GameDraw.cpp +++ b/src/saland/GameDraw.cpp
@@ -128,6 +128,15 @@ void DrawHumanEntity(SDL_Renderer* target, sago::SagoSpriteHolder* sHolder, cons
const sago::SagoSprite &myHair = sHolder->GetSprite(entity->race + "_"+hairAnimation+"_"+entity->hair+"_"+std::string(1,entity->direction));
myHair.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY);
}
+ if (entity->pants.length() > 0) {
+ const sago::SagoSprite &myPants = sHolder->GetSprite(entity->race + "_"+animation+"_"+entity->pants+"_"+std::string(1,entity->direction));
+ if (relativeAnimation) {
+ myPants.DrawProgressive(target, relativeAnimationState, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY);
+ }
+ else {
+ myPants.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY);
+ }
+ }
}
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 364aa77..35d70f5 100644 --- a/src/saland/model/placeables.hpp +++ b/src/saland/model/placeables.hpp
@@ -60,6 +60,7 @@ class Human : public Creature {
public:
std::string race = "male";
std::string hair = "hair_1";
+ std::string pants = "pants_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
};