X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FCapsuleFeedMenu.cpp;h=ead0d718c7382a67f1b3b00cfd0c00bf21313d87;hb=e8283bf94624b2f184d50dc1401bf45225c529d6;hp=f2631b90aecad4b40fbf6fb305a3362f2a01355c;hpb=e518ac67cf94e244df16078dcbc536e6b659e758;p=l2e.git diff --git a/src/menu/CapsuleFeedMenu.cpp b/src/menu/CapsuleFeedMenu.cpp index f2631b9..ead0d71 100644 --- a/src/menu/CapsuleFeedMenu.cpp +++ b/src/menu/CapsuleFeedMenu.cpp @@ -10,12 +10,13 @@ #include "../common/GameState.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" +#include "../math/Vector.h" using app::Input; using common::Capsule; using common::Inventory; using common::Item; -using geometry::Vector; +using math::Vector; using graphics::Font; using graphics::Frame; @@ -33,7 +34,9 @@ CapsuleFeedMenu::CapsuleFeedMenu(CapsuleMenu *parent) void CapsuleFeedMenu::OnEnterState(SDL_Surface *) { menu.SetSelected(); + menu.StartAnimation(Ctrl()); itemMenu.SetActive(); + itemMenu.StartAnimation(Ctrl()); } void CapsuleFeedMenu::LoadInventory() { @@ -132,16 +135,24 @@ void CapsuleFeedMenu::HandleEvents(const Input &input) { void CapsuleFeedMenu::FeedSelected() { if (itemMenu.Selected()) { // TODO: feed and grow animations - GetCapsule().Feed(itemMenu.Selected()); - parent->Game().state->inventory.Remove(itemMenu.Selected(), 1); - LoadInventory(); + if (GetCapsule().IsHungry()) { + GetCapsule().Feed(itemMenu.Selected()); + parent->Game().state->inventory.Remove(itemMenu.Selected(), 1); + LoadInventory(); + } else if (itemMenu.Selected() == GetCapsule().UpgradeItem()) { + GetCapsule().UpgradeSpecial(); + parent->Game().state->inventory.Remove(itemMenu.Selected(), 1); + LoadInventory(); + } else { + // error beep + } } else { - // beep + // also beep } } -void CapsuleFeedMenu::UpdateWorld(float deltaT) { +void CapsuleFeedMenu::UpdateWorld(Uint32 deltaT) { }