X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=d790928dc4fb851c7a96b956a92dbff3fdd5a47e;hb=eb2ad5ffd08128d31af32f3929a3295fcfa251e9;hp=2611a722aeba9b20ebf2431e33606e846be645e8;hpb=d71217e2be1466726581146000a0f61620423e9b;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 2611a72..d790928 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" @@ -17,7 +18,9 @@ #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" @@ -62,7 +65,8 @@ 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; @@ -86,7 +90,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); @@ -111,6 +115,7 @@ int main(int argc, char **argv) { common::TargetingMode::CreateTypeDescription(); graphics::Animation::CreateTypeDescription(); + graphics::CharSelect::CreateTypeDescription(); graphics::ComplexAnimation::CreateTypeDescription(); graphics::Font::CreateTypeDescription(); graphics::Frame::CreateTypeDescription(); @@ -174,7 +179,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; } @@ -194,8 +199,12 @@ int main(int argc, char **argv) { gameState.party[3] = &gameState.heroes[3]; gameState.partySize = 4; - gameState.capsules[0] = *caster.GetCapsule("flash"); - gameState.capsule = gameState.capsules; + 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; @@ -227,7 +236,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); @@ -270,17 +281,17 @@ 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()); @@ -310,22 +321,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;