diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index b5da0aa..4689543 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp @@ -272,6 +272,9 @@ Game::Game() { Spell& slot0 = data->slot_spell.at(0); slot0.icon = "effect_fireball"; slot0.name = "spell_fireball"; + Spell& slot1 = data->slot_spell.at(1); + slot1.icon = "item_weapon_long_knife"; + slot1.name = "weapon_slash_long_knife"; Spell& slot2 = data->slot_spell.at(2); slot2.icon = ""; slot2.name = "spell_create_block"; diff --git a/src/saland/GameDraw.cpp b/src/saland/GameDraw.cpp index 226ed51..658a976 100644 --- a/src/saland/GameDraw.cpp +++ b/src/saland/GameDraw.cpp @@ -210,6 +210,15 @@ void DrawHumanEntity(SDL_Renderer* target, sago::SagoSpriteHolder* sHolder, cons myHair.Draw(target, time, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY); } } + if (entity->weapon.length() > 0) { + const sago::SagoSprite& myWeapon = sHolder->GetSprite(entity->race + "_"+animation+"_"+entity->weapon+"_"+std::string(1,entity->direction)); + if (relativeAnimation) { + myWeapon.DrawProgressive(target, relativeAnimationState, std::round(entity->X) - offsetX, std::round(entity->Y) - offsetY); + } + else { + myWeapon.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 295664c..31198cc 100644 --- a/src/saland/model/placeables.hpp +++ b/src/saland/model/placeables.hpp @@ -75,6 +75,7 @@ public: std::string hair = ""; std::string pants = ""; std::string top = ""; + std::string weapon = ""; 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 };