diff --git a/data/sprites/std_hair.sprite b/data/sprites/std_hair.sprite new file mode 100644 index 0000000..a9b6cb6 --- /dev/null +++ b/data/sprites/std_hair.sprite @@ -0,0 +1,99 @@ +{ + +"male_walkcycle_standard_hair_N" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 64, + "topy" : 512, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_walkcycle_standard_hair_W" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 64, + "topy" : 576, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_walkcycle_standard_hair_S" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 64, + "topy" : 640, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_walkcycle_standard_hair_E" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 64, + "topy" : 704, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_standing_standard_hair_N" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 0, + "topy" : 512, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_standing_standard_hair_W" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 0, + "topy" : 576, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_standing_standard_hair_S" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 0, + "topy" : 640, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"male_standing_standard_hair_E" : { + "texture" : "std_hair/plain-male/redhead", + "topx" : 0, + "topy" : 704, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +} + +} diff --git a/data/sprites/std_hair_female.sprite b/data/sprites/std_hair_female.sprite new file mode 100644 index 0000000..9bb1a94 --- /dev/null +++ b/data/sprites/std_hair_female.sprite @@ -0,0 +1,99 @@ +{ + +"female_walkcycle_standard_hair_N" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 64, + "topy" : 512, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_walkcycle_standard_hair_W" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 64, + "topy" : 576, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_walkcycle_standard_hair_S" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 64, + "topy" : 640, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_walkcycle_standard_hair_E" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 64, + "topy" : 704, + "height" : 64, + "width" : 64, + "number_of_frames" : 8, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_standing_standard_hair_N" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 0, + "topy" : 512, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_standing_standard_hair_W" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 0, + "topy" : 576, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_standing_standard_hair_S" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 0, + "topy" : 640, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +}, + +"female_standing_standard_hair_E" : { + "texture" : "std_hair/ponytail2-female/redhead", + "topx" : 0, + "topy" : 704, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 100, + "originx" : 32, + "originy" : 50 +} + +} diff --git a/data/textures/std_hair/plain-male/blonde.png b/data/textures/std_hair/plain-male/blonde.png new file mode 100644 index 0000000..f65519e Binary files /dev/null and b/data/textures/std_hair/plain-male/blonde.png differ diff --git a/data/textures/std_hair/plain-male/blue.png b/data/textures/std_hair/plain-male/blue.png new file mode 100644 index 0000000..c8d0628 Binary files /dev/null and b/data/textures/std_hair/plain-male/blue.png differ diff --git a/data/textures/std_hair/plain-male/brunette.png b/data/textures/std_hair/plain-male/brunette.png new file mode 100644 index 0000000..943fe33 Binary files /dev/null and b/data/textures/std_hair/plain-male/brunette.png differ diff --git a/data/textures/std_hair/plain-male/green.png b/data/textures/std_hair/plain-male/green.png new file mode 100644 index 0000000..7c1b7f7 Binary files /dev/null and b/data/textures/std_hair/plain-male/green.png differ diff --git a/data/textures/std_hair/plain-male/pink.png b/data/textures/std_hair/plain-male/pink.png new file mode 100644 index 0000000..4355c9b Binary files /dev/null and b/data/textures/std_hair/plain-male/pink.png differ diff --git a/data/textures/std_hair/plain-male/raven.png b/data/textures/std_hair/plain-male/raven.png new file mode 100644 index 0000000..d546ce3 Binary files /dev/null and b/data/textures/std_hair/plain-male/raven.png differ diff --git a/data/textures/std_hair/plain-male/redhead.png b/data/textures/std_hair/plain-male/redhead.png new file mode 100644 index 0000000..c7b11e7 Binary files /dev/null and b/data/textures/std_hair/plain-male/redhead.png differ diff --git a/data/textures/std_hair/plain-male/shadows-darkbody.png b/data/textures/std_hair/plain-male/shadows-darkbody.png new file mode 100644 index 0000000..d6b6f79 Binary files /dev/null and b/data/textures/std_hair/plain-male/shadows-darkbody.png differ diff --git a/data/textures/std_hair/plain-male/shadows-lightbody.png b/data/textures/std_hair/plain-male/shadows-lightbody.png new file mode 100644 index 0000000..71ebd38 Binary files /dev/null and b/data/textures/std_hair/plain-male/shadows-lightbody.png differ diff --git a/data/textures/std_hair/plain-male/shadows-tanned2body.png b/data/textures/std_hair/plain-male/shadows-tanned2body.png new file mode 100644 index 0000000..a7ea7ff Binary files /dev/null and b/data/textures/std_hair/plain-male/shadows-tanned2body.png differ diff --git a/data/textures/std_hair/plain-male/shadows-tannedbody.png b/data/textures/std_hair/plain-male/shadows-tannedbody.png new file mode 100644 index 0000000..047b190 Binary files /dev/null and b/data/textures/std_hair/plain-male/shadows-tannedbody.png differ diff --git a/data/textures/std_hair/plain-male/white-blonde.png b/data/textures/std_hair/plain-male/white-blonde.png new file mode 100644 index 0000000..22e7d25 Binary files /dev/null and b/data/textures/std_hair/plain-male/white-blonde.png differ diff --git a/data/textures/std_hair/ponytail2-female/blonde.png b/data/textures/std_hair/ponytail2-female/blonde.png new file mode 100644 index 0000000..6748cd2 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/blonde.png differ diff --git a/data/textures/std_hair/ponytail2-female/blue.png b/data/textures/std_hair/ponytail2-female/blue.png new file mode 100644 index 0000000..4a0bc42 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/blue.png differ diff --git a/data/textures/std_hair/ponytail2-female/brunette.png b/data/textures/std_hair/ponytail2-female/brunette.png new file mode 100644 index 0000000..ef8b2e2 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/brunette.png differ diff --git a/data/textures/std_hair/ponytail2-female/green.png b/data/textures/std_hair/ponytail2-female/green.png new file mode 100644 index 0000000..860a5a7 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/green.png differ diff --git a/data/textures/std_hair/ponytail2-female/pink.png b/data/textures/std_hair/ponytail2-female/pink.png new file mode 100644 index 0000000..ecdf69f Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/pink.png differ diff --git a/data/textures/std_hair/ponytail2-female/raven.png b/data/textures/std_hair/ponytail2-female/raven.png new file mode 100644 index 0000000..8e74bc1 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/raven.png differ diff --git a/data/textures/std_hair/ponytail2-female/redhead.png b/data/textures/std_hair/ponytail2-female/redhead.png new file mode 100644 index 0000000..af767d6 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/redhead.png differ diff --git a/data/textures/std_hair/ponytail2-female/shadows-darkbody.png b/data/textures/std_hair/ponytail2-female/shadows-darkbody.png new file mode 100644 index 0000000..a7927a5 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/shadows-darkbody.png differ diff --git a/data/textures/std_hair/ponytail2-female/shadows-lightbody.png b/data/textures/std_hair/ponytail2-female/shadows-lightbody.png new file mode 100644 index 0000000..3117836 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/shadows-lightbody.png differ diff --git a/data/textures/std_hair/ponytail2-female/shadows-tanned2body.png b/data/textures/std_hair/ponytail2-female/shadows-tanned2body.png new file mode 100644 index 0000000..b00367e Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/shadows-tanned2body.png differ diff --git a/data/textures/std_hair/ponytail2-female/shadows-tannedbody.png b/data/textures/std_hair/ponytail2-female/shadows-tannedbody.png new file mode 100644 index 0000000..ccdb9b4 Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/shadows-tannedbody.png differ diff --git a/data/textures/std_hair/ponytail2-female/white-blonde.png b/data/textures/std_hair/ponytail2-female/white-blonde.png new file mode 100644 index 0000000..e133c1f Binary files /dev/null and b/data/textures/std_hair/ponytail2-female/white-blonde.png differ diff --git a/data/textures/std_hair/readme.txt b/data/textures/std_hair/readme.txt new file mode 100644 index 0000000..1b203e9 --- /dev/null +++ b/data/textures/std_hair/readme.txt @@ -0,0 +1,3 @@ +Auther: Joe White +License: GPl 3.0 or CC-BY-SA 3.0 +https://opengameart.org/content/ponytail-and-plain-hairstyles diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index 5c33fa9..490d5ad 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp @@ -114,10 +114,11 @@ struct ResetRegionConsoleCommand : public ConsoleCommand { static GotoConsoleCommand gcc; static ResetRegionConsoleCommand rrcc; +static Player player; + struct Game::GameImpl { GameRegion gameRegion; std::shared_ptr human; - Player player; float center_x = 0; float center_y = 0; bool drawCollision = true; @@ -179,11 +180,11 @@ Game::Game() { data->human.reset(new Human()); data->lastUpdate = SDL_GetTicks(); ResetWorld(0, 0, false); - data->human->pants = data->player.get_visible_bottom(); - data->human->hair = data->player.get_visible_hair(); + data->human->pants = player.get_visible_bottom(); + data->human->hair = player.get_visible_hair(); - data->human->race = data->player.get_visible_race(); - data->human->top = data->player.get_visible_top(); + data->human->race = player.get_visible_race(); + data->human->top = player.get_visible_top(); data->bottomField.SetHolder(globalData.dataHolder); data->bottomField.SetFontSize(20); diff --git a/src/saland/GameDraw.cpp b/src/saland/GameDraw.cpp index a0d1505..1de90d3 100644 --- a/src/saland/GameDraw.cpp +++ b/src/saland/GameDraw.cpp @@ -129,14 +129,6 @@ void DrawHumanEntity(SDL_Renderer* target, sago::SagoSpriteHolder* sHolder, cons } else { mySprite.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY); } - if (entity->hair.length() > 0) { - std::string hairAnimation = animation; - if (hairAnimation == "spellcast") { - hairAnimation = "standing"; - } - 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) { @@ -155,6 +147,14 @@ void DrawHumanEntity(SDL_Renderer* target, sago::SagoSpriteHolder* sHolder, cons myTop.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY); } } + if (entity->hair.length() > 0) { + std::string hairAnimation = animation; + if (hairAnimation == "spellcast") { + hairAnimation = "standing"; + } + 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); + } } 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/Player.hpp b/src/saland/model/Player.hpp index 403ead1..6d5d15b 100644 --- a/src/saland/model/Player.hpp +++ b/src/saland/model/Player.hpp @@ -30,7 +30,7 @@ struct Player { Player() {}; std::string save_name="player1"; std::string get_visible_race() {return "female";} - std::string get_visible_hair() {return "hair_1";} + std::string get_visible_hair() {return "standard_hair";} std::string get_visible_bottom() {return "pants_1";} std::string get_visible_top(){return "pirate_shirt_sky";} std::string get_visibla_hat(){ return "";}