-/*
- * SpellMenu.cpp
- *
- * Created on: Nov 18, 2012
- * Author: holy
- */
-
#include "SpellMenu.h"
#include "HeroStatus.h"
#include "PartyMenu.h"
#include "Resources.h"
+#include "../app/Application.h"
#include "../app/Input.h"
#include "../common/GameConfig.h"
#include "../common/GameState.h"
#include "../common/Spell.h"
#include "../graphics/Font.h"
#include "../graphics/Frame.h"
+#include "../math/Vector.h"
+#include <algorithm>
#include <SDL.h>
#include <vector>
using app::Input;
using common::Hero;
using common::Spell;
-using geometry::Vector;
+using math::Vector;
using graphics::Font;
using graphics::Frame;
using std::vector;
SDL_SetAlpha(highlight, SDL_SRCALPHA|SDL_RLEACCEL, 0x20);
actionMenu.SetSelected();
+ actionMenu.StartAnimation(Ctrl());
LoadSpells();
+ spellMenu.StartAnimation(Ctrl());
}
void SpellMenu::LoadSpells() {
return *parent->Game().state->party[cursor];
}
+Hero &SpellMenu::GetHero() {
+ return *parent->Game().state->party[cursor];
+}
+
void SpellMenu::OnExitState(SDL_Surface *) {
SDL_FreeSurface(highlight);
}
if (input.JustPressed(Input::ACTION_A)) {
if (actionMenu.IsActive()) {
if (actionMenu.Selected() == CHOICE_SORT) {
- // TODO: sort spells
+ std::sort(GetHero().Spells().begin(),
+ GetHero().Spells().end(),
+ Spell::Less);
LoadSpells();
} else {
actionMenu.SetSelected();
// TODO: use spell
}
} else {
- // TODO: swap spells
+ std::swap(GetHero().Spells().at(spellMenu.SelectedIndex()),
+ GetHero().Spells().at(spellMenu.SecondaryIndex()));
spellMenu.SwapSelected();
spellMenu.SetActive();
}
}
}
-void SpellMenu::UpdateWorld(float deltaT) {
+void SpellMenu::UpdateWorld(Uint32 deltaT) {
}