- attackChoices.resize(heroes.size());
- for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
- spellMenus.push_back(res->spellMenuPrototype);
- // TODO: insert real spell menu entries
- spellMenus.back().Add("Reset : 0", 0);
- spellMenus.back().Add("Strong : 3", 0);
- spellMenus.back().Add("Stronger : 8", 0);
- spellMenus.back().Add("Champion :16", 0);
- spellMenus.back().Add("Rally :10", 0);
- spellMenus.back().Add("Valor :30", 0);
- spellMenus.back().Add("Poison : 2", 0);
- spellMenus.back().Add("Release : 2", 0);
- spellMenus.back().Add("Waken : 4", 0);
- spellMenus.back().Add("Fake : 4", 0);
- spellMenus.back().Add("Trick : 5", 0);
- heroTags.push_back(HeroTag(&heroes[i], &attackChoices[i], res, HeroTag::Alignment((i + 1) % 2)));
+ for (int i(0); i < 4; ++i) {
+ spellMenus[i] = res->spellMenuPrototype;
+ LoadSpellMenu(i);
+ ikariMenus[i] = res->ikariMenuPrototype;
+ LoadIkariMenu(i);
+ heroTags[i] = HeroTag(this, i);
+ smallHeroTags[i] = SmallHeroTag(this, i);
+ }
+
+ int tagHeight(attackTypeMenu.Height());
+ int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2);
+ int xOffset((BackgroundWidth() - 2 * tagWidth) / 2);
+ heroTagPositions[0] = Point<int>(xOffset, BackgroundHeight() - 2 * tagHeight);
+ heroTagPositions[1] = Point<int>(xOffset + tagWidth, BackgroundHeight() - 2 * tagHeight);
+ heroTagPositions[2] = Point<int>(xOffset, BackgroundHeight() - tagHeight);
+ heroTagPositions[3] = Point<int>(xOffset + tagWidth, BackgroundHeight() - tagHeight);
+
+ tagHeight = res->normalFont->CharHeight() * 4 + res->smallHeroTagFrame->BorderHeight() * 2;
+ tagWidth = res->normalFont->CharWidth() * 6 + res->smallHeroTagFrame->BorderWidth() * 2;
+ xOffset = (BackgroundWidth() - 4 * tagWidth) / 2;
+ int yOffset(BackgroundHeight() - tagHeight);
+ smallHeroTagPositions[0] = Point<int>(xOffset, yOffset);
+ smallHeroTagPositions[1] = Point<int>(xOffset + 2 * tagWidth, yOffset);
+ smallHeroTagPositions[2] = Point<int>(xOffset + tagWidth, yOffset);
+ smallHeroTagPositions[3] = Point<int>(xOffset + 3 * tagWidth, yOffset);
+
+ itemMenu = res->itemMenuPrototype;
+ LoadInventory();
+}
+
+void BattleState::LoadSpellMenu(vector<Hero>::size_type index) {
+ spellMenus[index].Clear();
+ spellMenus[index].Reserve(HeroAt(index).Spells().size());
+ for (vector<const Spell *>::const_iterator i(HeroAt(index).Spells().begin()), end(HeroAt(index).Spells().end()); i != end; ++i) {
+ bool enabled((*i)->CanUseInBattle() && (*i)->Cost() <= HeroAt(index).Mana());
+ spellMenus[index].Add((*i)->Name(), *i, enabled, 0, (*i)->Cost());
+ }
+}
+
+void BattleState::LoadIkariMenu(vector<Hero>::size_type index) {
+ ikariMenus[index].Clear();
+ ikariMenus[index].Reserve(6);
+
+ if (HeroAt(index).HasWeapon()) {
+ ikariMenus[index].Add(
+ HeroAt(index).Weapon()->Name(),
+ HeroAt(index).Weapon(),
+ HeroAt(index).Weapon()->HasIkari() && HeroAt(index).Weapon()->GetIkari()->Cost() <= HeroAt(index).IP(),
+ res->weaponMenuIcon,
+ 0,
+ HeroAt(index).Weapon()->HasIkari() ? HeroAt(index).Weapon()->GetIkari()->Name() : "");
+ } else {
+ ikariMenus[index].Add(res->noEquipmentText, 0, false, res->weaponMenuIcon);
+ }
+
+ if (HeroAt(index).HasArmor()) {
+ ikariMenus[index].Add(
+ HeroAt(index).Armor()->Name(),
+ HeroAt(index).Armor(),
+ HeroAt(index).Armor()->HasIkari() && HeroAt(index).Armor()->GetIkari()->Cost() <= HeroAt(index).IP(),
+ res->armorMenuIcon,
+ 0,
+ HeroAt(index).Armor()->HasIkari() ? HeroAt(index).Armor()->GetIkari()->Name() : "");
+ } else {
+ ikariMenus[index].Add(res->noEquipmentText, 0, false, res->armorMenuIcon);
+ }
+
+ if (HeroAt(index).HasShield()) {
+ ikariMenus[index].Add(
+ HeroAt(index).Shield()->Name(),
+ HeroAt(index).Shield(),
+ HeroAt(index).Shield()->HasIkari() && HeroAt(index).Shield()->GetIkari()->Cost() <= HeroAt(index).IP(),
+ res->shieldMenuIcon,
+ 0,
+ HeroAt(index).Shield()->HasIkari() ? HeroAt(index).Shield()->GetIkari()->Name() : "");
+ } else {
+ ikariMenus[index].Add(res->noEquipmentText, 0, false, res->shieldMenuIcon);
+ }
+
+ if (HeroAt(index).HasHelmet()) {
+ ikariMenus[index].Add(
+ HeroAt(index).Helmet()->Name(),
+ HeroAt(index).Helmet(),
+ HeroAt(index).Helmet()->HasIkari() && HeroAt(index).Helmet()->GetIkari()->Cost() <= HeroAt(index).IP(),
+ res->helmetMenuIcon,
+ 0,
+ HeroAt(index).Helmet()->HasIkari() ? HeroAt(index).Helmet()->GetIkari()->Name() : "");
+ } else {
+ ikariMenus[index].Add(res->noEquipmentText, 0, false, res->helmetMenuIcon);
+ }
+
+ if (HeroAt(index).HasRing()) {
+ ikariMenus[index].Add(
+ HeroAt(index).Ring()->Name(),
+ HeroAt(index).Ring(),
+ HeroAt(index).Ring()->HasIkari() && HeroAt(index).Ring()->GetIkari()->Cost() <= HeroAt(index).IP(),
+ res->ringMenuIcon,
+ 0,
+ HeroAt(index).Ring()->HasIkari() ? HeroAt(index).Ring()->GetIkari()->Name() : "");
+ } else {
+ ikariMenus[index].Add(res->noEquipmentText, 0, false, res->ringMenuIcon);