X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=f0811de23ede1282543681de19c6996aff6223f2;hb=b9e715649b41cb69ea1b2d2a588522541eb87b46;hp=53301ce5f5c785fa7c97d6d49f047936fa35e91c;hpb=2255d436a0c2acc10b015827366a72b2ece86094;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 53301ce..f0811de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include "keys.h" #include "app/Application.h" #include "app/Arguments.h" #include "app/Input.h" @@ -7,16 +8,20 @@ #include "battle/Monster.h" #include "battle/PartyLayout.h" #include "battle/Resources.h" +#include "common/Capsule.h" #include "common/GameConfig.h" #include "common/GameState.h" #include "common/Hero.h" #include "common/Ikari.h" #include "common/Inventory.h" #include "common/Item.h" +#include "common/LevelUp.h" #include "common/Script.h" #include "common/Spell.h" #include "common/Stats.h" -#include "geometry/Vector.h" +#include "math/Fixed.h" +#include "math/Vector.h" +#include "graphics/CharSelect.h" #include "graphics/ComplexAnimation.h" #include "graphics/Font.h" #include "graphics/Frame.h" @@ -54,14 +59,15 @@ using app::Application; using app::Arguments; using app::Input; using battle::BattleState; -using battle::Capsule; using battle::Monster; using battle::PartyLayout; +using common::Capsule; using common::GameConfig; using common::GameState; using common::Hero; using common::Spell; -using geometry::Vector; +using math::Fixed; +using math::Vector; using graphics::Texture; using loader::Caster; using loader::Interpreter; @@ -85,7 +91,7 @@ int main(int argc, char **argv) { const int width = 512; const int height = 448; - const float walkSpeed = 128.0f; + const Fixed<8> walkSpeed = Fixed<8>(1, 8); bool battle(false); @@ -101,14 +107,17 @@ int main(int argc, char **argv) { battle::Monster::CreateTypeDescription(); battle::PartyLayout::CreateTypeDescription(); + common::Capsule::CreateTypeDescription(); common::Hero::CreateTypeDescription(); common::Ikari::CreateTypeDescription(); common::Item::CreateTypeDescription(); + common::LevelUp::CreateTypeDescription(); common::Stats::CreateTypeDescription(); common::Spell::CreateTypeDescription(); common::TargetingMode::CreateTypeDescription(); graphics::Animation::CreateTypeDescription(); + graphics::CharSelect::CreateTypeDescription(); graphics::ComplexAnimation::CreateTypeDescription(); graphics::Font::CreateTypeDescription(); graphics::Frame::CreateTypeDescription(); @@ -172,7 +181,7 @@ int main(int argc, char **argv) { if (intp.PostponedDefinitions().size() > 0) { for (vector::const_iterator i(intp.PostponedDefinitions().begin()), end(intp.PostponedDefinitions().end()); i != end; ++i) { - std::cerr << "missing definition of " << TypeDescription::Get(i->linkedType).TypeName() << " " << i->identifier << std::endl; + std::cerr << "missing definition of " << TypeDescription::Get(i->type).TypeName() << " " << i->identifier << std::endl; } return 3; } @@ -192,6 +201,13 @@ int main(int argc, char **argv) { gameState.party[3] = &gameState.heroes[3]; gameState.partySize = 4; + gameState.capsules[1] = *caster.GetCapsule("flash"); + gameState.capsules[1].UpgradeClass(); + gameState.capsules[1].UpgradeClass(); + gameState.capsules[1].UpgradeClass(); + gameState.capsules[1].UpgradeClass(); + gameState.capsule = 1; + GameConfig gameConfig; gameConfig.state = &gameState; gameConfig.heroesLayout = caster.GetPartyLayout("heroesLayout"); @@ -222,7 +238,9 @@ int main(int argc, char **argv) { gameState.heroes[0].AddSpell(valorSpell); gameState.heroes[1].AddSpell(valorSpell); - gameState.inventory.Add(caster.GetItem("zirconPlateItem")); + gameState.inventory.Add(caster.GetItem("zirconPlateItem"), 32); + gameState.inventory.Add(caster.GetItem("holyFruitItem")); + gameState.inventory.Add(caster.GetItem("darkFruitItem")); gameState.inventory.Add(caster.GetItem("antidoteItem"), 9); gameState.inventory.Add(caster.GetItem("powerRingItem")); gameState.inventory.Add(caster.GetItem("magicJarItem"), 4); @@ -265,43 +283,20 @@ int main(int argc, char **argv) { gameState.heroes[3].SetEquipment(Hero::EQUIP_RING, caster.GetItem("rocketRingItem")); gameState.heroes[3].SetEquipment(Hero::EQUIP_JEWEL, caster.GetItem("krakenRockItem")); - gameState.heroes[0].MapEntity().Position() = Vector(64, 128); + gameState.heroes[0].MapEntity().Position() = Vector >(64, 128); - gameState.heroes[1].MapEntity().Position() = Vector(64, 128); + gameState.heroes[1].MapEntity().Position() = Vector >(64, 128); gameState.heroes[1].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING); gameState.heroes[0].MapEntity().AddFollower(&gameState.heroes[1].MapEntity()); - gameState.heroes[2].MapEntity().Position() = Vector(64, 128); + gameState.heroes[2].MapEntity().Position() = Vector >(64, 128); gameState.heroes[2].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING); gameState.heroes[1].MapEntity().AddFollower(&gameState.heroes[2].MapEntity()); - gameState.heroes[3].MapEntity().Position() = Vector(64, 128); + gameState.heroes[3].MapEntity().Position() = Vector >(64, 128); gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING); gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity()); - graphics::Sprite flashSprite(IMG_Load("test-data/flash.png"), 96, 96); - graphics::ComplexAnimation flashAttackAnimation(&flashSprite, 132); - graphics::ComplexAnimation::FrameProp flashAttackFrames[4]; - flashAttackFrames[0] = graphics::ComplexAnimation::FrameProp(0, 1, Vector(0, -16)); - flashAttackFrames[1] = graphics::ComplexAnimation::FrameProp(0, 0, Vector(0, -16)); - flashAttackFrames[2] = graphics::ComplexAnimation::FrameProp(0, 1, Vector(0, -16)); - flashAttackFrames[3] = graphics::ComplexAnimation::FrameProp(0, 0, Vector(0, -16)); - flashAttackAnimation.SetFrames(flashAttackFrames, 4); - Capsule capsule; - capsule.SetName("Flash"); - capsule.SetHealth(5, 5); - capsule.SetLevel(1); - capsule.GetStats().SetAttack(12); - capsule.GetStats().SetDefense(18); - capsule.GetStats().SetStrength(2); - capsule.GetStats().SetAgility(11); - capsule.GetStats().SetIntelligence(16); - capsule.GetStats().SetGut(23); - capsule.GetStats().SetMagicResistance(11); - capsule.SetBattleSprite(&flashSprite); - capsule.SetAttackAnimation(&flashAttackAnimation); - capsule.SetMeleeAnimation(gameState.heroes[0].MeleeAnimation()); - InitScreen screen(width, height); app::State *state(0); @@ -312,7 +307,7 @@ int main(int argc, char **argv) { battleState->AddMonster(monster); battleState->AddMonster(monster); battleState->AddMonster(monster); - battleState->SetCapsule(capsule); + battleState->SetCapsule(caster.GetCapsule("flash")); battleState->AddHero(gameState.heroes[0]); battleState->AddHero(gameState.heroes[1]); battleState->AddHero(gameState.heroes[2]); @@ -328,22 +323,7 @@ int main(int argc, char **argv) { } Application app(screen, state); - app.Buttons().MapKey(SDLK_w, Input::PAD_UP); - app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT); - app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN); - app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT); - app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A); - app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B); - app.Buttons().MapKey(SDLK_UP, Input::ACTION_X); - app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y); - app.Buttons().MapKey(SDLK_RETURN, Input::START); - app.Buttons().MapKey(SDLK_SPACE, Input::SELECT); - app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT); - app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT); - app.Buttons().MapKey(SDLK_1, Input::DEBUG_1); - app.Buttons().MapKey(SDLK_2, Input::DEBUG_2); - app.Buttons().MapKey(SDLK_3, Input::DEBUG_3); - app.Buttons().MapKey(SDLK_4, Input::DEBUG_4); + MapKeys(app.Buttons()); app.Run(); return 0;