X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=793a76fa6f8b1c9e0b33690f2f772f28cfc4fc06;hb=fc8a43f3745e7f3808e29b90a2fa9a958ecaf29b;hp=ff49b66bb578b11a9536fb476abcb7b868d6b75d;hpb=616330670a0c3d9d4554c145e997129747d05979;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index ff49b66..793a76f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,7 +102,7 @@ int main(int argc, char **argv) { const int tileSize = 32; const float walkSpeed = 128.0f; - const bool battle(false); + bool battle(false); // std::srand(std::time(0)); @@ -127,6 +127,7 @@ int main(int argc, char **argv) { Sprite::CreateTypeDescription(); Stats::CreateTypeDescription(); common::TargetingMode::CreateTypeDescription(); + Entity::CreateTypeDescription(); Arguments args; args.Read(argc, argv); @@ -137,7 +138,7 @@ int main(int argc, char **argv) { Parser(*i, source).Parse(); } - switch (args.DetectRunLevel()) { + switch (args.GetRunLevel()) { case Arguments::WRITE: { int length(std::strlen(args.OutfilePath())); @@ -157,7 +158,15 @@ int main(int argc, char **argv) { std::cout << source << std::endl; return 0; } + case Arguments::SOURCE_WIKI: { + TypeDescription::WriteSourceWiki(std::cout); + return 0; + } + case Arguments::BATTLE: + battle = true; + break; case Arguments::PLAY: + case Arguments::MAP: break; } @@ -509,35 +518,19 @@ int main(int argc, char **argv) { triggers2[0].map = &map1; triggers2[0].target = Vector(8, 3); - SimpleAnimation mapMaximAnimation(gameState.heroes[0].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); - Entity mapMaxim; - mapMaxim.SetAnimation(&mapMaximAnimation); - mapMaxim.Position() = Vector(64, 128); - mapMaxim.SpriteOffset() = Vector(0, -32); - - SimpleAnimation mapSelanAnimation(gameState.heroes[1].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); - Entity mapSelan; - mapSelan.SetAnimation(&mapSelanAnimation); - mapSelan.Position() = Vector(64, 128); - mapSelan.SpriteOffset() = Vector(0, -32); - mapSelan.SetFlags(Entity::FLAG_NONBLOCKING); - mapMaxim.AddFollower(&mapSelan); - - SimpleAnimation mapGuyAnimation(gameState.heroes[2].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); - Entity mapGuy; - mapGuy.SetAnimation(&mapGuyAnimation); - mapGuy.Position() = Vector(64, 128); - mapGuy.SpriteOffset() = Vector(0, -32); - mapGuy.SetFlags(Entity::FLAG_NONBLOCKING); - mapSelan.AddFollower(&mapGuy); - - SimpleAnimation mapDekarAnimation(gameState.heroes[3].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); - Entity mapDekar; - mapDekar.SetAnimation(&mapDekarAnimation); - mapDekar.Position() = Vector(64, 128); - mapDekar.SpriteOffset() = Vector(0, -32); - mapDekar.SetFlags(Entity::FLAG_NONBLOCKING); - mapGuy.AddFollower(&mapDekar); + gameState.heroes[0].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().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().SetFlags(Entity::FLAG_NONBLOCKING); + gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity()); SDL_Surface *mapMonsterImg(IMG_Load("test-data/monster-map.png")); Sprite mapMonsterSprite(mapMonsterImg, 32, 32); @@ -566,7 +559,7 @@ int main(int argc, char **argv) { } else { MapState *mapState(new MapState(&map1)); - mapState->ControlEntity(&mapMaxim); + mapState->ControlEntity(&gameState.heroes[0].MapEntity()); mapState->SetWalkingSpeed(walkSpeed); mapMonster.StartAnimation(*mapState);